NEW YORK (AP) -- The warning came just moments too late: A man who had shot his ex-girlfriend a few hours earlier had traveled to New York City and vowed online to shoot two "pigs" in retaliation for the police chokehold death of Eric Garner.
Minutes before a wanted poster for Ismaaiyl Brinsley arrived in the NYPD's Real Time Crime Center, he ambushed two officers in their patrol car in broad daylight, fatally shooting them before killing himself inside a subway station.
Brinsley, 28, wrote on an Instagram account before Saturday's shootings: "I'm putting wings on pigs today. They take 1 of ours, let's take 2 of theirs," two city officials with direct knowledge of the case confirmed for The Associated Press. He used the hashtags Shootthepolice RIPErivGardner (sic) RIPMikeBrown -- references to the two police-involved deaths of blacks that have sparked racially charged protests across the country.
The officials, a senior city official and a law enforcement official, were not authorized to speak publicly on the topic and spoke on condition of anonymity.
Police said Brinsley approached the passenger window of a marked police car and opened fire, striking Officers Rafael Ramos and Wenjian Liu in the head. Brinsley was black; the officers were Asian and Hispanic, police said. The officers were on special patrol doing crime reduction work in the Bedford-Stuyvesant section of Brooklyn.
"They were, quite simply, assassinated -- targeted for their uniform," said Police Commissioner Bill Bratton, who looked pale and shaken at a hospital news conference.
The sudden and extraordinary violence stunned the city, prompted a response from a vacationing President Barack Obama and escalated weeks of simmering ill will between police and their critics following grand jury decisions not to indict officers in the deaths of Garner in New York and Michael Brown in Missouri. The New York police union head declared there's "blood on the hands" of protesters and the city's mayor.
Brinsley took off running after the shooting. Officers chased him down to a nearby subway station, where he shot himself in the head as a subway train door full of people closed. A silver handgun was recovered at the scene, Bratton said.
"This may be my final post," Brinsley wrote in the post that included an image of a silver handgun. The post had more than 200 likes but also had many others admonishing his statements.
Bratton said the suspect made very serious "anti-police" statements online but did not get into specifics of the posts.
The Rev. Al Sharpton said Garner's family has no connection to the suspect and denounced the violence.
"We have stressed at every rally and march that anyone engaged in any violence is an enemy to the pursuit of justice for Eric Garner and Michael Brown," he said.
Brown's family condemned the shooting in a statement posted online by their attorney.
"We reject any kind of violence directed toward members of law enforcement. It cannot be tolerated. We must work together to bring peace to our communities," the family said.
Garner, who was black, died after he was taken down by a white officer during an arrest on suspicion of selling loose cigarettes. The 18-year-old Brown, who was black, was fatally shot by a white officer. He was unarmed.
Most of the protests have been peaceful, particularly in New York. Bratton said police were investigating whether Brinsley had attended any rallies or demonstrations and why he had chosen to kill the officers.
Mayor Bill de Blasio said the killings of Ramos and Liu strike 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."
Scores of officers in uniform lined up three rows deep at the hospital driveway. The line stretched into the street. Officers raised their hands in a silent salute as two ambulances bore away the slain officers' bodies. The mayor ordered flags at half-staff.
In a statement Saturday night, Attorney General Eric Holder condemned the shooting deaths as senseless and "an unspeakable act of barbarism." Obama, vacationing in Hawaii, issued a statement saying he unconditionally condemns the slayings.
"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," Obama said. "Tonight, I ask people to reject violence and words that harm, and turn to words that heal -- prayer, patient dialogue, and sympathy for the friends and family of the fallen."
The tragedy ended a bizarre route for Brinsley that began in Maryland early Saturday. He went to the home of a former girlfriend in a Baltimore suburb and shot and wounded her. Police there said they noticed Brinsley posting from the woman's Instagram account threats to kill New York officers.
Baltimore-area officials sent a warning to New York City police, who received it moments too late, Bratton said.
But the posts were apparently online for hours, though it's not clear if anyone reported them. Bratton called on New Yorkers to alert authorities of any threats to police they see -- even if they don't seem real. "That information must get into the hands of the police officers," he said.
Brinsley had a history of arrests in Georgia for robbery, disorderly conduct and carrying a concealed weapon. Bratton said his last-known address was in Georgia, but he had some ties to Brooklyn.
Meanwhile, the department grieved the sudden and violent loss of the officers.
"Both officers paid the ultimate sacrifice today while protecting the communities they serve," Bratton said Saturday night.
Ramos was married with a 13-year-old son and had another in college, police and a friend said. He had been on the job since 2012 and was a school safety officer. Liu had been on the job for seven years and got married two months ago.
Rosie Orengo, a friend of Ramos, said he was heavily involved in their church and encouraged others in their marriages.
"He was an amazing man. He was the best father and husband and friend," she said. "Our peace is knowing that he's OK, and we'll see him in heaven."
De Blasio and the president of the Patrolmen's Benevolent Association, Patrick Lynch, have been locked in a public battle over treatment of officers following the grand jury's decision in the Garner case. Just days ago, Lynch suggested police officers sign a petition that demanded the mayor not attend their funerals should they die on the job. On Saturday, some officers turned their backs on de Blasio as he walked into the hospital.
"That blood on the hands starts at the steps of City Hall, in the office of the mayor," Lynch said. "After the funerals, those responsible will be called on the carpet and held accountable."
De Blasio was scheduled to attend Mass with Cardinal Timothy Dolan at St. Patrick's Cathedral on Sunday.
The last shooting death of a New York City officer came in December 2011, when 22-year veteran Peter Figoski was shot in the face while responding to a report of a break-in at a Brooklyn apartment. The triggerman, Lamont Pride, was convicted of murder and sentenced in 2013 to 45 years to life in prison.