Hundreds of mourning cops from around the nation turned their backs en masse Saturday on Mayor Bill de Blasio's eulogy for assassinated police officer Rafael Ramos.

The stunning act of defiance, by some watching de Blasio via a giant TV screen outside the funeral service, is a sign that cop dissatisfaction with the liberal mayor hasn't gone away.

"It's painful to watch. Quite frankly this whole thing is painful to watch," said Garry McCarthy, Chicago police superintendent and former head of the Newark police, who came to Queens for Ramos' funeral.

The long-simmering antipathy to de Blasio first spilled out into public view after officers Ramos and Wenjian Liu were killed Dec. 20, and NYPD officers turned their backs on de Blasio as he walked into a hospital the day of the shooting. The head of the largest police union said de Blasio had blood on his hands.

In the aftermath of a grand jury decision weeks earlier not to indict an NYPD officer in the death of Eric Garner on Staten Island, de Blasio had infuriated the police unions when he recounted having coached his biracial son to be cautious around the police.

Sgt. Calvin McGee of the New Rochelle Police Department said he turned his back Saturday to show solidarity with the NYPD: "I turned to show support -- we always support each other."

Sgt. Myron Joseph, also of New Rochelle, said the moment was spontaneous, explaining: "I support the decision of our brothers in blue from the New York City Police Department."

Asked about the protests, mayoral spokesman Wiley Norvell said: "Our sole focus is unifying this city and honoring the lives of our two police officers."

It wasn't just outside the church that the atmosphere was tense, according to South Pasadena, California, Police Chief Arthur Miller. Miller said he could sense the tension and "negative energy" from the pews: "It was very apparent that something was going on."

In a brief interview with CNN, Patrick Lynch, president of the rank-and-file Patrolmen's Benevolent Association union, said: "The feeling is real, but today's about mourning. Tomorrow's about debate . . . We have to understand the betrayal that they feel."

Expect future such acts of defiance by city police, said Kenneth Sherrill, an emeritus professor of political science at Hunter College.

"It establishes a new normal. It establishes a situation where we can expect to see police do that whenever the mayor is making an appearance. It will come to define the relationship," Sherill said. "You would think that during a service of that sort there would be a ceasefire."

Although most politicians at the funeral were inside, word quickly spread of the back turning.

Former Mayor Rudy Giuliani, who has jousted with de Blasio over police issues, said, "The office of mayor is entitled to the greatest respect, having been mayor, but I understood their emotion."

Rep. Pete King (R-Seaford) said: "Maybe it takes something like this to remind people of just how dangerous their job is and how courageous these guys are."

"People across our nation are showing grief for our fallen heroes," Brooklyn borough President Eric Adams said. "Unfortunately, that pain sometimes involves a display of misplaced anger."

With Darran Simon and Alison Fox