Last Updated Dec 21, 2014 1:53 AM EST
NEW YORK -- An armed man walked up to two New York Police Department officers sitting inside a patrol car and opened fire Saturday afternoon, striking them both before running into a nearby subway station and committing suicide, NYPD Commissioner Bill Bratton said.
The shooting took place in Brooklyn's Bedford-Stuyvesant neighborhood. Both officers were shot in the head and rushed to a hospital, where they later died.
At a news conference Saturday night, Bratton identified the officers as Wenjian Liu, a seven-year veteran of the NYPD, and Raphael Ramos, who joined the force two years ago.
"They were, quite simply, assassinated -- targeted for their uniform," Bratton said. "They were ambushed and murdered."
"Officer Ramos and Officer Liu never had the opportunity to draw their weapons," Bratton said. "They may never have had the chance to see their murderer."
The gunman, identified as 28-year-old Ismaaiyl Brinsley, shot himself inside the subway station, Bratton said. A semi-automatic handgun was recovered at the scene. His motives aren't yet clear.
Mayor Bill de Blasio said the killing of the officers in the nation's largest department strikes at the heart of the city. "Our city is in mourning. Our hearts are heavy," said de Blasio, who spoke softly with moist eyes. "It is an attack on all of us."
In statement, President Obama said, "I unconditionally condemn today's murder of two police officers in New York City. Two brave men won't be going home to their loved ones tonight, and for that, there is no justification. The officers who serve and protect our communities risk their own safety for ours every single day - and they deserve our respect and gratitude every single day."
Bratton and de Blasio met with the officers' families Saturday evening. Both men leave behind wives -- Wu was just married two months ago -- and Ramos also had a 13-year old son who "couldn't comprehend what had happened to his father," the mayor said.
Scores of officers in uniform lined up three rows deep outside the hospital to honor the fallen police officers as their bodies were taken away amid silence. New York firefighters formed lines on either side of the road as ambulances carried the officers' bodies away.
Bratton said Brinsley had shot and seriously wounded his ex-girlfriend Saturday morning in Baltimore and made posts from her Instagram account that were "very anti-police."
Authorities didn't get into the specifics of the contents of the posts, but a police source told CBS News that Brinsley posted a photo of a handgun on Instagram a few hours before the shooting. CBS News could not independently verify that the message came from the suspect.
"I'm Putting Wings On Pigs Today," the post said. "They Take 1 Of Ours. Let's Take 2 Of Theirs. #ShootThePolice #RIPErivGardner (sic) #RIPMikeBrown This May Be My Final Post. I'm Putting Pigs In A Blanket"
De Blasio urged the public to contact authorities any time they saw threats online or heard them in person.
Baltimore County Police learned that Brinsley had a connection to Brooklyn and had faxed a warning flier to the NYPD, but it was not received until around the same time as the 2:47 p.m. shooting, Bratton said.
A large contingent of police officers and emergency service unit officers responded to the area, near the intersection of of Myrtle Avenue and Tompkins Avenue, with helmets, machine guns and bulletproof vests.
A block from the shooting site, a line of about eight police officers stood with a German shepherd blocking the taped-off street. Streets were blocked even to pedestrians for blocks around.
Derrick Thompson, who lives nearby, said the shooting happened across from the Tompkins Houses public housing development.
"I was watching TV, and then I heard the helicopters," Thompson said. "I walked out, and all of a sudden -- this."
"I heard the shots from the upper end of the corner, I was coming out of the restaurant eating," a witness said. "About four or five shots, and that's what drew my attention to come down here and be nosy."
"They were actually on post here as part of an initiative and somebody came upon them and took their lives," City Councilman Robert Cornegy said at the scene.
The shooting comes at a time when police in New York and nationwide are being heavily criticized for their tactics following the chokehold death of Eric Garner, a black man who was stopped by police for selling loose, untaxed cigarettes and could be heard on an amateur video gasping "I can't breathe" as he was being arrested.
"Everybody is feeling different things, but I don't think anybody in their right mind called for the death of an officer," Cornegy said. "People are frustrated with the results of Staten Island and Eric Garner, but I don't think I know anyone in this community that would agree with taking the lives of an officer."
In a statement, Attorney General Eric Holder condemned the shootings as "cowardly" and an "unspeakable act of barbarism."
Holder praised law enforcement officers as courageous men and women who routinely incur tremendous personal risks, and place their lives on the line every day to preserve public safety. He says all Americans are forever in their debt.
Saturday's killings were the seventh time since 1972 that NYPD partners were both killed on duty, Bratton said.
The last shooting death of an NYPD officer came in December 2011, when 22-year veteran Peter Figoski responded to a report of a break-in at a Brooklyn apartment. He was shot in the face and killed by one of the suspects hiding in a side room when officers arrived. The triggerman, Lamont Pride, was convicted of murder and sentenced in 2013 to 45 years to life in prison.