Three suspects were arrested after a man was shot six times in Manhattan early Sunday, the NYPD said.

Ramel Harkless, 38, Joseph Saunders, 43, and Barry Wiles, 46, all from Brooklyn, were arrested and charged in the incident, police said. Charges include first-degree assault, criminal use of a firearm and reckless endangerment.

The suspects and the victim had extensive criminal histories, police said. The victim apparently had a long, ongoing dispute with the suspects, they said.

The shooting occurred shortly before 1 a.m. Sunday at 105 W. 22nd St. in the Flatiron District, cops said. ​The victim was shot in the torso, leg and groin, police said.

Plainclothes officers were on patrol in an unmarked vehicle when they heard the shots fired. The officers saw a man run into a black Mercedes sedan, and pursued the vehicle eastbound on West 22nd Street, police said.

During the pursuit, at 19th Street and Park Avenue South, the Mercedes made a sudden stop, causing a minor collision with the unmarked vehicle, police said. After the collision, officers took the three men into custody. A semi-automatic handgun was found in plain sight in the Mercedes, the NYPD said.

The victim was taken to Bellevue Hospital Center for surgery and was listed in critical but stable condition, police said.

"I want to commend all of the officers involved in this response and apprehension," Manhattan South Duty Captain Stephen Spataro said in a statement. "They reacted quickly, during an evolving situation that was inherently dangerous. They put themselves in harm's way and successfully brought the incident to a swift conclusion."