The detective and two colleagues were near Monroe Street and Bedford Avenue trying to draw out the scammers where they'd robbed an apartment hunter earlier that day, sources said.
As the undercover officer passed three men on the street, unrelated to the scam, Altron Atwater, 20, pulled out his Daisy Powerline 415 BB gun, put it to the detective's head and demanded the detective's cellphone. The detective handed over the phone then shot the suspect, police said.
A neighbor heard Atwater shout, "You shot me! You shot me! Why'd you shoot me?"
Atwater was taken to Kings County Hospital in stable condition, police said.
He faced charges of robbery, grand larceny, petit larceny, menacing, criminal possession of a weapon and harassment, police said.
His accomplices Demeris Pittman, 16 and from Bedford-Stuyvesant, and Paul Moore, 15 and from Canarsie, were also arrested, police said. They faced the same charges.
Atwater's weapon that was used in the would-be mugging was found at the scene, the NYPD said.
Atwater and the two boys denied any involvement in the earlier scam, sources said. Video seemed to indicate that they decided to mug the detective in the spur of the moment and not out of some plan, sources said.
The detectives were trying to catch the Craigslist scammers after a woman had been robbed at that intersection earlier that day, sources said.
A man in a ski mask lured her there and tried to take her phone and wallet, but fled without doing so, sources said.
She alerted police and gave them the man's phone number so they could set up a sting and pose as apartment seekers, sources said.
Two detectives waited in a nearby car as another walked out to meet the scammers, until he was waylaid, sources said.
The team has pulled this Craigslist scam at least four times since late September, according to the NYPD's Chief of Detectives Robert Boyce.
Neighbors were disturbed about the robbery.
"I'm shocked. This neighborhood's changed so much," said Steve Burrell, a high school guidance counselor who grew up in the area.