Mayor de Blasio’s aides urged political allies to attack the police unions for their tactics just days before the mayor met with five police union leaders to hammer out a truce, sources revealed Tuesday.

One elected official told The Post that de Blasio’s aides reached out after the funeral for Det. Rafael Ramos in which dozens of rank-and-file officers turned their backs on the mayor as he spoke.

The aides requested public criticisms of the “union’s tactics,” the source said.

De Blasio’s government affairs officials also privately began reaching out to allies as recently as this Monday – just one day before his peace pipe pow-wow with union leaders at the police academy, DNAinfo.com first reported Tuesday.

“City Hall wanted me to blast the Patrolmen’s Benevolent Association for turning their backs on him,” one legislator told the web site. “They called up Monday, said they were calling all of us, and that it was our obligation to stand up defending the mayor.”

One City Council insider said only that the administration was seeking to circle the wagons amid a growing rift with NYPD rank-and-file.

“He gave us talking points, but it was very much a unity message,” the insider said. “They’re not asking us to defend them against [PBA President] Pat Lynch. They’re trying to keep everyone in line and have a unity message.”

City Hall officials strongly dismissed claims that they were seeking attack dogs, saying the only outreach that was made was in a bid to unite a fractured city.

“The Administration did not ask elected officials to ‘attack’ anyone,” said City Hall spokeswoman Marti Adams. “As we’ve often done, we reached out to public officials to ask that they stand with the Mayor and his requests for New Yorkers to do all they can to respect and support the families of Officers Ramos and Liu as the city deals with this unconscionable tragedy.”