A gunman with an apparent grudge "assassinated" two uniformed New York police officers in a cold-blooded attack on their patrol car that followed weeks of outrage over police killings of unarmed black men.
The two officers, one a newlywed, were shot in the head through the window of their vehicle in broad daylight in Brooklyn on Saturday in an attack that left America's biggest city reeling just days before Christmas.
"Today, two of New York's finest were shot and killed with no warning, no provocation," said an emotional New York Police Commissioner Bill Bratton.
"They were quite simply assassinated."
Police named the shooter as 28-year-old Ismaaiyl Brinsley, an African American who shot and seriously wounded his ex-girlfriend in Baltimore early Saturday before driving to Brooklyn to murder the two officers.
Cities across the United States have seen weeks of protests condemning a string of recent police killings of unarmed black men and decisions by grand juries not to press charges against the white officers responsible.
Bratton said social media postings showed that Brinsley "had a very strong bias against police officers."
Just hours before the shooting, Brinsley apparently boasted on Instagram of wanting to kill cops.
Wenjian Liu, a seven-year police veteran who got married two months ago, and Rafael Ramos, who leaves behind a 13-year-old son, were "ambushed and murdered" as they sat in the front seats of a marked NYPD police car, officials said.
Neither officer had a chance to draw his weapon before Brinsley opened fire with several rounds and fled to a nearby subway station.
He shot himself in the head on the platform, where Bratton said a silver semi-automatic firearm was recovered near his body.
President Barack Obama condemned the attack "unconditionally" in a statement, saying it had "no justification."
"Tonight, I ask people to reject violence and words that harm, and turn to words that heal," Obama said.
Attorney General Eric Holder said the attack is a reminder of the dangers US police face regularly.
"As a nation we must not forget this as we discuss the events of the recent past," he said in a statement that appeared to refer to the country's ongoing police controversy.
New York Mayor Bill de Blasio said the city of 8.4 million was in mourning.
"When a police officer is murdered, it tears at the foundation of our society. It is an attack on all of us," he said.
"Our entire city was attacked by this heinous individual."
The police chief said the motive was still under investigation, but did not rule out a connection to anti-police protests that have swept the country.
"One of the unfortunate aspects at times is some people get caught up in these and go in directions they should not," he said.
In a cruel twist of fate, Bratton said Baltimore police warned New York colleagues that Brinsley may be on the loose just as the murder took place.
In October, a man with a hatchet attacked four young New York officers in what police said was an act of terror by a self-radicalized Muslim convert.
"They Take 1 of Ours... Let's Take 2 of Theirs," read a comment seemingly written by Brinsley next to a photo of a silver handgun, referencing the police killings of unarmed blacks.
In July, Eric Garner, an unarmed father of six, died after police held him in a chokehold while he was being arrested for selling individual cigarettes illegally in New York.
Michael Brown, an 18-year-old in the Ferguson suburb of St Louis, Missouri, was shot dead by a police officer in August, sparking months of protests.
Grand jury decisions not to indict either white officer responsible triggered mass protests in New York and other US cities.
The Brown family swiftly condemned the latest killings as "senseless."
"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," they said in a statement.
Civil rights activist Al Sharpton, who has used the deaths of Garner and Brown to campaign for sweeping police reform, also said he was outraged.
But the head of a New York police association blamed city officials for not going far enough to stop those who incited violence during protests against police.
"That blood on their hands starts on the steps of city hall in the office of the mayor," Patrolmen's Benevolent Association head Patrick Lynch said about Saturday's shootings.
Widespread dissatisfaction in relations between police and blacks have been inflamed not just by the Brown and Garner deaths.
Last month, a rookie police officer fatally shot Akai Gurley, an unarmed 28-year-old black man, in the stairwell of a Brooklyn apartment building.
A 12-year-old black boy holding a toy gun was also shot dead by police officers in a playground in Ohio in November.