The head of the state Policemen's Benevolent Association says the unchecked climate of "hatred" against police officers contributed to the shooting deaths of two New York cops Saturday.

"The attack on these officers is nothing less then an act of domestic terrorism spurred on by so much recent hatred aimed at officers everywhere," Patrick Colligan said in an emailed statement. "Our society stands safer because of the sacrifices officers make everyday, but the hatred that has grown over the past few weeks in this country has gone unchecked by many elected leaders. We all need to stand up, speak up, and oppose those who attack our law enforcement everywhere."

Officers Wenjian Liu and Rafael Ramos suffered gunshot wounds to the head as they sat in a patrol car in Bedford-Stuyvesant, New York City Police Commissioner Bill Bratton said at a news conference tonight. They were there as part of a violence-reduction effort.

Ismaaiyl Brinsley, 28, of Georgia, has been identified as the shooter, Bratton said.

Bratton said that authorities are still investigating motive, but investigators are looking at "anti-police" postings on the social media site Instagram.

The Associated Press reported that Brinsley announced on social media that he "was planning to shoot two "pigs" in retaliation for the police chokehold death of Eric Garner."

Brinsley apparently drove up from Maryland, where earlier in the day he had shot and gravely injured his ex-girlfriend, authorities said.

The shooting comes at a particularly sensitive time for police departments all around the nation. Just this month, a grand jury in Staten Island declined to indict the officers involved in the chokehold death of Eric Garner, an unarmed black man. Daniel Pantaleo, one of the officers who was trying to bring Garner into custody for selling loose cigarettes, put his arm around Garner's neck in bringing him to the ground.

Garner's last words have become a rallying cry for protestors around the country: "I can't breathe!"

Garner's death was indicative of a culture of wanton police violence toward the African-American community, the protestors have claimed in demonstrations that have remained mostly peaceful.

Bratton, the police commissioner, said the NYPD does not know whether Brinsley was connected to the protests. A police investigation will try to answer that question, Bratton said, as part of an effort to make sense of what happened. Posts on social media have purportedly linked Brinsley to anti-police sentiments as a result of the Garner case in Staten Island and the Michael Brown case in Missouri.

The New Jersey police union, meanwhile, said their prayers are with the family and friends of the two officers.

"Today is a tragic day and change must come to the American debate," said Colligan.

He added: "These two officers did what so many of us (do) everyday when we put on our uniform, leave our families behind, and look to help the communities we serve."

The Rev. Al Sharpton, a civil rights leader who has organized many of the protests, said tonight: "An eye for an eye leaves the whole world blind. We all at (the National Action Network) express our prayers and condolences to the families of the 2 NYC officers."

According to the New York Daily News, Liu was 32 and had married only seven months ago. Ramos, 40, had a 13-year-old son.

Brian Amaral may be reached at bamaral@njadvancemedia.com. Follow him on Twitter @bamaral44. Find NJ.com on Facebook.