An 18-year-old gunman responsible for a Brooklyn shooting that ended with a cop getting hit by friendly fire from a fellow officer was ordered held on $50,000 during his arraignment — and has already posted his bail, officials said Wednesday.

Camani Bartletto, 18, was caught on surveillance camera opening fire on a black Toyota Rav 4 operated by an Uber driver on Nostrand Ave. and St. John’s Place in Crown Heights at about 4:12 a.m. on Sunday, cops said.

A passenger was in the Uber when two bullets shattered the driver’s side window and hit the driver’s door, according to prosecutors.

No injuries were reported, but Bartletto quickly got the attention of a group of officers, members of an NYPD Mobile Force Command, sitting in an unmarked cruiser a short distance from the shooting.

The teen walked past an unmarked police car with the gun still visible in his hand, multiple sources told the Daily News.

NYPD Detective Robert Karroll was taken to Kings County Hospital after he was shot in the back during a shootout with an armed 18yr old male teenager who approached their unmarked black Kia SUV and opened fire as he and other Officers were parked on Nostrand Avenue near Saint John's Place in Brooklyn on July 5th, 2026. 0932. Officers returned fire but the teen was not struck. The teen was chased down and placed under arrest a few blocks away. NYPD Commissioner Jessica Tisch stated that the bullet struck the bullet proof vest being worn by Detective Karroll and that this saved his life. (Theodore Parisienne / New York Daily News)
Police investigate after an NYPD detective was shot early Sunday on Nostrand Ave. and St. John’s Place in Brooklyn. (Theodore Parisienne / New York Daily News)

The officers jumped out of the cruiser and gave chase, moving so quickly that they forgot to turn on their body-worn cameras, NYPD Commissioner Jessica Tisch said at a briefing Sunday.

During the chase, three officers fired off rounds, but did not hit Bartletto. Detective Robert Karrol, a 20-year NYPD veteran and father of three, was struck in the back of his ballistic vest with a projectile from a stray shot, police sources said.

As he ran off, Bartletto tried to ditch the gun by tossing it away, but the gun hit the ground right in front of a pursuing NYPD sergeant, Brooklyn prosecutors said late Tuesday.

Cops arrested Bartletto after a brief chase. He was subdued with the use of a Taser and was charged him with attempted murder for shooting at the Uber driver, as well as reckless endangerment, criminal use of a firearm and criminal possession of a weapon, officials said.

NYPD Detective Robert Karroll was taken to Kings County Hospital after he was shot in the back during a shootout with an armed 18yr old male teenager who approached their unmarked black Kia SUV and opened fire as he and other Officers were parked on Nostrand Avenue near Saint John's Place in Brooklyn on July 5th, 2026. 0932. Officers returned fire but the teen was not struck. The teen was chased down and placed under arrest a few blocks away. NYPD Commissioner Jessica Tisch stated that the bullet struck the bullet proof vest being worn by Detective Karroll and that this saved his life. (Theodore Parisienne / New York Daily News)
Police investigate after an NYPD detective was shot early Sunday on Nostrand Ave. and St. John’s Place in Brooklyn. (Theodore Parisienne / New York Daily News)

At his arraignment, a Brooklyn Criminal Court judge ordered Bartletto held on $50,000 bail. He had posted the bail Wednesday after spending the night on Rikers Island, according to court documents.

Medics rushed Karroll and another officer who suffered bruising to her face and shoulder during the incident to Kings County Hospital. Both are expected to recover.

“I want to take this moment to express my gratitude that this incident did not hold more grave consequences — and to Det. Karroll, and to every officer who has been safeguarding our city over what has been a busy holiday weekend,” Mayor Mamdani said at a press conference on Sunday.

Bartletto lives in West Orange, NJ. It was not immediately clear why he fired at the Uber driver.

Video surveillance recovered at the scene showed the teen pointing a gun at someone outside a deli on Nostrand Ave. before taking aim at the Toyota, authorities said.