A 4-year-old girl was shot in the back when her mom’s boyfriend and another man began shooting at each other in the Bronx Wednesday morning, police said.

Frederick Fielder, 33, who is believed to be the boyfriend of the girl’s mom, and James Thomas, 57, got into a fight and shot at each other in front of a building at 167th Street and Clay Avenue in the East Concourse neighborhood around 11:45 a.m., police said. It remains under investigation if there was a third gunman, police said.

“They agreed to meet here, these two groups. It was three on one side and three on the other, at which point the fisticuffs begin and that’s when the guns came out,” Chief of Detectives Robert Boyce said at a news conference following the shooting, adding that police have obtained video of the incident.

The men fired 17 shots in total, Boyce said, and one of the bullets grazed the 4-year-old girl. Both Fielder and Thomas were also hit, police said. All had non-life-threatening injuries.

Fielder has nine priors, including arrests for robbery, weapons possession and gang assault, police said. Thomas has seven priors for robbery, drug possession, grand larceny, attempted murder and forgery, according to police.

The girl and Fielder were privately transported to Lincoln Hospital, and Thomas was privately transported to Bronx-Lebanon Hospital Center, a police spokesman said.

Fielder and Thomas were later charged with assault, criminal use of a firearm and reckless endangerment, among other charges, police said.

With Anthony DeStefano and Ivan Pereira