— -- Two New York City police officers were "assassinated," shot "execution-style" as they sat in their patrol vehicle in the Bedford-Stuyvesant neighborhood of Brooklyn, city officials said.
NYPD Commissioner William Bratton said the two officers were shot with "no warning, no provocation."
"Two of New York's finest were shot and killed, with no warning, no provocation," Bratton said. "They were quite simply assassinated -- targeted for their uniform."
New York Mayor Bill de Blasio described the shooting of the two as they sat in a critical response vehicle in a Broklyn housing project as being carried out "execution style."
Officers Wenjian Liu and Raphael Ramos were sitting in their vehicle shortly before 3 p.m. when a man approached the car on the passenger side, took a "shooter's stance" and opened fire, Bratton said.
Liu and Ramos may have not even seen the gunman before they were shot, Bratton said.
"Officer Liu and Officer Ramos never had the opportunity to draw their weapons," he said. "They may never have actually seen their assailant, their murderer."
"It is an attack on all of us, it is an attack on everything we hold dear," de Blasio said.
The suspect -- identified by police as Ismaayil Brinsley, 28 -- then ran to a nearby subway entrance, with police in pursuit, the commissioner said.
Brinsley went down into the subway and ran onto the platform, where he shot himself in the head, killing himself, Bratton said.
Police believe Brinsley shot his ex-girlfriend in Baltimore earlier in the day, and then posted "anti-police postings" on her Instagram account, the police commissioner said.
Baltimore police investigating the shooting there found the posts, which included threats against New York police, and sent a message alerting the NYPD about Brinsley, but it arrived just about the time the shootings occurred, Bratton said.
Liu had gotten married just two months ago. Ramos, who had just turned 40, was a police officer for two years, fulfilling what Bratton said was a lifelong dream of being a cop. Before joining the NYPD he had been a school safety officer.
"Our city is in mourning. Our hearts are heavy," de Blasio said. "We lost two good men who devoted their lives to protecting all of us."
Hours after the shooting, dozens of police in tactical gear were still gathering evidence and had cordoned off a roughly three-block area around the site of the shooting, while other officers watched over the scene from rooftops in the area.
The shooting comes at a time when police nationwide are being heavily criticized for the deaths of unarmed black men. In New York City, Eric Garner, a black man who was stopped by police for selling loose, untaxed cigarettes, died after an officer put him in a chokehold.
"I can't breathe" -- words Garner could be heard gasping during his arrest, which was captured on an amateur video -- have become a rallying cry for demonstrators across the country.
One city councilman told ABC station WABC-TV in New York that the shooting in Brooklyn was "the worst thing that could have happened."
Until today, no NYPD officer had been fatally shot since December 2011, when Peter Figoski, a 22-year veteran, responded to a report of a break-in at a Brooklyn apartment and was shot in the face by one of the suspects hiding in a side room. The shooter, Lamont Pride, was convicted of murder and sentenced in 2013 to 45 years to life in prison.
Get real-time updates as this story unfolds. To start, just "star" this story in ABC News' phone app. Download ABC News for iPhone here or ABC News for Android here. To be notified about our live weekend digital reports, tap here.