An internal investigation is under way in Detroit after undercover cops from two different precincts exchanged blows and even pulled their guns on each other during a drug raid gone wrong, according to a report.

Two undercover officers from the department’s 12th Precinct were conducting a “push off” operation late Thursday — posing as drug dealers to ensnare would-be buyers — when two undercover cops from the 11th Precinct approached and ordered them to the ground, sources told WJBK.

The two sets of cops then began fighting each other instead of nabbing drug suspects, throwing punches and even brandishing their service weapons, sources told the station.

“You’ve gotta have more communication, I guess,” a homeowner who witnessed the incident told the station. “I don’t understand that happened about that — communicate.”

After obtaining a search warrant to raid a home in the 19000 block of Andover Street, the undercover unit from the 11th Precinct entered the home, but then a separate team of cops from the 12th Precinct stormed the location before the home could be secured, WDIV reports.

One officer was taken to the hospital after the incident, according to the station, which quoted an unidentified cop who said the crew from the 12th Precinct didn’t follow proper protocol since it didn’t notify the department of the raid, which occurred three blocks inside the 11th Precinct’s territory.

Officers from the 12th Precinct also didn’t properly notify the 11th Precinct during a prostitution sting last week that led to a police chase, according to the police source.

In all, about 24 cops were involved, including some in full tactical gear and armed with assault rifles who were pushing and shoving each other in the “heated” and “bruising” incident, WXYZ reports.

The officers and their command staff are part of an investigation by the department’s internal affairs unit, a police spokeswoman confirmed to The Post.

“There was an incident between two different groups of officers from two different precincts,” Officer Jennifer Moreno said.

Moreno declined further comment on the “altercation” and said she could not confirm that punches were thrown or that undercover officers drew their service weapons during the incident. It’s unclear if any officers were injured, she said.

One of undercover units, meanwhile, had their body cameras rolling during the incident and that footage is now part of the ongoing internal investigation, WJBK reports.