They could be riding with unsuspecting New Yorkers on the subway. Or behind the wheel in a car in midtown Manhattan traffic. Or mingling with revelers at the New Year's Eve celebration in Times Square.

They are the New York Police Department's plainclothes officers — a legion of law enforcers with a mandate to blend into everyday life and spring into action at the earliest signs of trouble. It's a less visible, proactive role that can run risks for police, as demonstrated by last weekend's shooting of Officer Brian Moore.

Police officials won't say exactly how many of the department's roughly 20,000-officer patrol force turn out each day wearing street clothes instead of the NYPD's dark blue uniform, though former officers and experts believe it's well into the hundreds.

The distinction goes beyond mere apparel. Unlike regular patrol officers whose job revolves around responding to 911 calls, the plainclothes officers are expected to catch criminals in the act — or even before they act.

Part of the role is to target "the small segment of the population that commits most of the crime in New York City," Chief of Department James O'Neill told The Associated Press. Another, he added, is "looking for people who might have guns, and that's what happened to Brian."

Moore, 25, and his partner were on patrol in an unmarked Ford Crown Victoria in Queens on the night of May 2 when police say they noticed Demetrius Blackwell on the street grabbing at his waistband. After the officers pulled up near the suspect and Moore identified himself as a police officer, he asked, "Do you have something in your waistband?" authorities said.

Blackwell allegedly replied, "Yeah, I got something," pulled out a handgun and fired three times at the officers, striking Moore in the head and cheek.

The suspect, who has done prison time for robbery, was later caught and charged with murder. He has pleaded not guilty.

The killing follows the January shooting of two plainclothes officers in the Bronx while they were investigating an armed robbery at a grocery store. An intense manhunt ended in two arrests.

All three officers were part of roving anti-crime units housed in each of the city's 77 precincts. Similar units are deployed in the subways. The department also uses plainclothes officers when policing New Year's Eve, parades and protests such as Occupy Wall Street.

The department has also used the officers in decoy operations — pretending to be careless subway riders — in response to spikes in thefts of smartphones and other electronic devices on the subways. But that's as close as they come to actual undercover work, which involves assuming a false identity as part of an ongoing investigation.

Those in the anti-crime units — considered a career path to getting a detective's gold shield — are selected because they've displayed a greater willingness to put themselves in harm's way and an eye for identifying suspects, said former NYPD commander Kevin Perham.

"You have to be an active cop," said Perham, whose career included a stint in plain clothes. "It's not just arrests, but an ability to adapt to whatever the crime of the day is."

Moore had won four medals for arresting suspects in violent crimes both as a patrolman and in his anti-crime unit. His last was on March 18, when he arrested a man with a loaded firearm following a foot chase.

The officer "could 'smell a gun,' as they say," Police Commissioner William Bratton said while eulogizing Moore. "He had the gift."

In high-crime neighborhoods, savvy criminals can spot a plainclothes officer. But some don't — an advantage shown Thursday on a Brooklyn subway platform being patrolled by plainclothes Officer Jacobo Rosario.

Rosario, spotting a man urinating in a restricted area, waited until the man walked up to within a few feet of him and his partner before stopping him and identifying himself as a police officer, the officer said. When the man wouldn't give straight answers and look him in the eye, the officer frisked him and found a handgun and a magazine with hollow-point bullets, he said.

In his line of work, getting the gun "felt good because there are so many out there," Rosario said. "I guess I just got lucky because nobody was hurt."

The use of plainclothes officers has seen difficulties: In 1994, a white off-duty NYPD officer shot and severely wounded a black plainclothes officer as the plainclothes officer, his gun drawn, was pursuing a gunman on a subway platform — a case of mistaken identity some black officers claimed showed white colleagues were too quick to seek blacks as criminals. The shooter was convicted of assault and sentenced to five years of probation.

Five years later in a more notorious case, four white officers working in a plainclothes anti-crime team fired 41 shots and killed Guinea immigrant Amadou Diallo as he stood, unarmed and reaching for his wallet, in the vestibule of his apartment building in the Bronx. The officers were acquitted at a criminal trial, but not before the shooting sparked angry protests accusing police of using overly aggressive tactics that abused minorities.

Still, the practice has persisted and now is considered a time-tested and essential crime-fighting tool needed to preserve historic lows in the crime rate.

"There's still bad people out there committing these crimes and we can't wait for it to happen," O'Neill said. "Without plainclothes cops, we'd just be reactive."