Two police officers shot and killed 'execution style' in Brooklyn
NYC police responding to shooting (Photo credit: Liam Quigley)

A gunman who had posted anti-police statements on social media ambushed two New York police officers as they sat in their squad car on Saturday and then killed himself, police said.

The officers were killed without warning in their marked police car as they were on duty in the Bedford-Stuyvesant section of Brooklyn, Police Commissioner William Bratton told a news conference flanked by Mayor Bill de Blasio.

"They were quite simply assassinated," he said.

Bratton said the gunman, Ismaaiyl Brinsley, 28, took a shooter's stance on the passenger side of the squad car and opened fire with a silver semi-automatic handgun.

He then fled into a nearby subway station and died there from a self-inflicted gunshot wound to the head, Bratton said.

Brinsley had shot and seriously wounded his girlfriend in Baltimore County, Maryland, early on Saturday before traveling to Brooklyn, where he had connections, the police chief said.

Bratton said there was no indication at this point that the killings were linked to terrorism.

The news conference was held at Brooklyn's Woodhull Medical Center, where the police officers were taken.

The police deaths followed weeks of protests in New York and other parts of the United States after separate cases in which grand juries declined to charge two white police officers involved in the deaths of two unarmed black men.

New York police have come under intense pressure in recent weeks, with protests erupting after a grand jury declined to charge an officer involved in the chokehold death of Eric Garner during an arrest attempt in the borough of Staten Island.

Quoting a law enforcement source, NBC's New York affiliate reported that the gunman may have been seeking retribution against police after posting a threatening message on a social media account.

(Reporting by Ian Simpson, Sebastien Malo and Jonathan Allen; editing by G Crosse, Gunna Dickson and Frances Kerry)