The man who shot dead two New York police officers told members of the public to “watch what I’m going to do” shortly before the attack, police say.
Ismaaiyl Brinsley, 28, had a history of violence and mental instability.
Candlelit vigils have been held in New York in memory of officers Wenjian Liu, 32, and Rafael Ramos, 40.
Brinsley shot them as they sat in their patrol car in Brooklyn on Saturday before running into a subway station and shooting himself.
Hours earlier, he had shot and wounded his 29-year-old ex-girlfriend, Shaneka Thompson, at her home in Baltimore, Maryland, police said.
The New York Police Department’s Chief of Detectives, Robert Boyce, said that for weeks before the shooting, Brinsley had posted anti-police and anti-government messages on his Instagram account referring to the deaths of Michael Brown and Eric Garner.
Protests erupted across the US last month after grand juries in Missouri and then New York declined to charge the white police officers who killed the two unarmed black men.
Chief Boyce said Brinsley had also shared his feelings of “self-despair and anger at himself and where his life was” in recent posts.
When he arrived in New York on Saturday – hours after shooting Ms Thompson in the stomach – Brinsley threatened on Instagram to kill police officers.
“They Take 1 of Ours… Let’s Take 2 of Theirs #ShootThePolice #RIPEricGarner #RIPMike Brown,” he continued before adding: “This May Be My Final Post.”