Brinsley's gun
A silver semi-automatic Taurus firearm, which NYPD says was recovered on the subway platform near the body of 28-year-old shooting suspect Ismaaiyl Brinsley Reuters

Two New York police officers were gunned down by a lone shooter, in an apparent revenge attack for the deaths of Michael Brown and Eric Garner.

Lui Wenjin, 32, and Raphael Ramos, 40, were on duty when they were shot dead in their police car in the Bedford-Stuyvesant neighbourhood of Brooklyn. After shooting the policemen, the gunman turned his weapon on himself.

The killings were carried out by Ismaaiyl Brinsley, 28, in what NYPD representatives have called a targeted "assassination".

The attack appears to have been premeditated, with Brinsley posting a warning message on social media, threatening into shoot two "pigs" in revenge for the recent deaths of Brown and Garner.

Prior to carrying out the shooting of two police officers, Brinsley shot his ex-girlfriend, leaving her with serious injuries. The incident happened on Saturday in Baltimore, Maryland, prompting Brinsley to flee to New York.

Ismaaiyl Brinsley Instagram Post
Ismaaiyl Brinsley's final post on Instagram. The photograph has since been taken down Source: Instagram

Baltimore police tried to alert the New York police department after the Baltimore shooting, but the message arrived too late.

An image has emerged on social media showing Ismaaiyl Brinsley's final post on his Instagram account. Brinsley wrote: "I'm putting wings on pigs today. They take 1 of ours… Let's take 2 of theirs."

The post also contained several hashtags, paying tribute to Eric Garner and Michael Brown: "#RIPEricGardner (sic) #RIPMikeBrown."

Brinsley also filled this final post on social media with icons that appear to look like bullet marks, before stating "this may be my final post".

The chilling caption ends: "I'm putting pigs in a blanket," indicating Brinsley's apparent intention to shoot dead two people.

Eric Garner and Michael Brown, both of African-American ethnicity, died at the hands of white police officers in separate incidents in New York and Missouri, sparking widespread protests and violence.

"Die-in" protests, where demonstrators cover themselves in blood and lie motionless on the streets in great numbers, have been staged in protest over the two deaths.

At a news conference at the hospital where the two victims were taken, Police Commissioner Bill Bratton, said: "They were, quite simply, assassinated — targeted for their uniform."

Bratton also said that the police were looking into whether Brinsley attended any of the recent protests or demonstrators.

The revenge shootings have already been heavily condemned by Reverend Al Sharpton, a prominent civil rights leader.

Sharpton, who has become a figurehead in support for the grieving families of Eric Garner and Michael Brown, denounced the shootings: "Any use of the names of Eric Garner and Michael Brown, in connection with any violence or killing of police, is reprehensible and against the pursuit of justice in both cases."

The appalling shootings have been strongly condemned by President Obama, who said that the shooting could not be justified.