(CNN) -- Not too long after a man ambushed and killed two police officers sitting in a patrol car in New York City, the finger-pointing started.

Ismaaiyl Brinsley walked up to Officers Wenjian Liu and Rafael Ramos on Saturday in Brooklyn as they sat in their patrol car and shot them in the head, authorities said.

Police said he later used the same gun to commit suicide.

Former New York Gov. George Pataki and police union officials quickly lashed out at New York Mayor Bill de Blasio. The governor accused de Blasio of putting officers' lives at risk because the mayor supported recent protests over the killing of Eric Garner by a New York police officer who was not indicted.

At a hospital where the slain officers' bodies were taken, a group of fellow officers turned their backs and faced a wall when de Blasio walked by them on his way to a news conference during which he condemned the slayings.

Earlier, officers and New York Fire Department personnel saluted an ambulance carrying the two officers as it drove by.

They stood at attention, some with tears rolling down their cheeks.

Ex-governor blames mayor

Pataki, a Republican, cast disdain at the Democratic mayor and the U.S. attorney general in a post on Twitter.

"Sickened by these barbaric acts, which sadly are a predictable outcome of divisive anti-cop rhetoric of Eric Holder and Mayor de Blasio," he tweeted.

Pataki was referring to de Blasio's and Holder's support for peaceful protests that decried alleged police brutality in the killings of Eric Garner in New York and Michael Brown in Ferguson, Missouri, two unarmed black men.

Former New York City Mayor Rudy Giuliani said Pataki was wrong for making those comments. "That's a very damaging thing to say," Giuliani told CNN on Sunday. "It's an overreaction. That is not true."

Other mayors have lost officers, Giuliani said, and officers were killed during his term as mayor. He added that his heart went out to Bratton and to de Blasio.

Referring to the gunman, the ex-mayor said, "This sounded like an insane man who was going to commit murder."

Hours before Saturday's attack in New York, suspected gunman Brinsley appeared to have made statements on social media suggesting he planned to kill police and expressing outrage over the deaths of Garner and Brown.

Pat Lynch, the head of New York's Patrolmen's Benevolent Association, has vehemently attacked the mayor before and did so again the day of the shooting.

"There's blood on many hands tonight," Lynch said before making reference to the mayor's office.

De Blasio did not respond to the denunciations against him, but he described the killing of the officers as an "assassination." Holder described it as a "cowardly attack."

#BlueLivesMatter and #BlackLivesMatter

Brooklyn Borough President Eric Adams was joined by other New York borough presidents Sunday as he urged the public to refrain from protesting until the slain officers are buried.

"Blood is on the hands of one individual -- a sick man who did a sick act," he said.

He urged that the community find "the correct tone and professionalism" in the wake of the slayings, adding, "This is the painful day for all of us. ... We cannot allow anyone to assassinate public safety in this city."

Social media users joined the fray, with many objecting to blaming anyone other than the gunman for the killings.

Some turned to hashtags #BlackLivesMatter for Garner and Brown -- and #BlueLivesMatter to show respect and support for police officers.

"Everyone who turned Michael Brown into a saint, the assassination of those cops is on you," username @mattcale52 tweeted.

Akilah Hughes tweeted that, "#BlackLivesMatter is a call for justice, not a call for retribution."

"Do not pin the death of these two NYPD officers on a peaceful movement," she posted.

David Simpson said supporters should not choose one side or the other.

"#BlackLivesMatter and #BlueLivesMatter and #AllLivesMatter," he tweeted. "Recognize racism, push for justice for all."

Officials weigh in

The murders triggered reactions of condemnation and sadness from across the nation.

Barack Obama

"Two brave men won't be going home to their loved ones tonight, and for that, there is no justification," the President said in a statement. "The officers who serve and protect our communities risk their own safety for ours every single day -- and they deserve our respect and gratitude every single day."

Bill de Blasio

In addition to calling the shootings an "assassination," he said, "It is an attack on all of us. It is an attack on everything we hold dear."

Eric Holder

"This cowardly attack underscores the dangers that are routinely faced by those who protect and serve their fellow citizens. Our nation must always honor the valor -- and the sacrifices -- of all law enforcement officers with a steadfast commitment to keeping them safe."

Loretta E. Lynch

Obama's nominee to replace Holder as attorney general is the current U.S. attorney for the Eastern District of New York. She pledged her district's support in the investigation.

"Today, two have fallen, in a stark reminder of the challenges and risks that our law enforcement officers face every day, both in New York City and throughout our nation," Lynch said.

Michael Brown's family

"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.

The Rev. Al Sharpton

"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. We have stressed at every rally and march that anyone engaged in any violence is an enemy to the pursuit of justice for Eric Garner and Michael Brown."

CNN's Kristina Sgueglia, Ben Brumfield and Kevin Liptak contributed to this report.