Two days after scores of police officers turned their backs to a video monitor as NYC Mayor Bill de Blasio spoke at slain NYPD officer's funeral, the mayor was received with mixed response from hundreds of new recruits at a police graduation ceremony. (The Washington Post)

New York Mayor Bill de Blasio, struggling to get beyond a crisis that has opened a rift with the city’s police force, offered up an olive branch at a graduation ceremony for cadets, hailing them for undertaking a “noble calling.”

But the rift showed few signs of closing as the mayor was met by boos and hecklers during his speech, and a handful of people in the crowd turned their backs to him. For much of his address to the 884 graduates inside Madison Square Garden, the new officers and the rest of the audience remained largely silent.

Two days earlier, hundreds of police officers outside Christ Tabernacle Church in Queens had turned their backs as de Blasio spoke at the funeral of Rafael Ramos, who was fatally shot Dec. 20 with his partner, Wenjian Liu, in their squad car. The gunman, who killed himself after the ambush, had stated his intent to avenge the deaths of unarmed black men at the hands of law enforcement.

In the days since the shooting, police union officials and others have accused the mayor of fueling anti-police sentiment, going back to his 2013 campaign, in which he heavily criticized the police department’s “stop and frisk” tactic, which disproportionately affected African Americans and Latinos.

On Sunday, Police Commissioner William J. Bratton sought to spread the blame toward Washington. Asked on NBC’s “Meet the Press” about the roles of President Obama and Attorney General Eric H. Holder Jr., Bratton said that police “feel they are under attack from the federal government at the highest levels. So, that’s something we need to understand also, this sense of perception that becomes a reality.”

The White House declined to comment on Bratton’s remarks Monday. Obama has been careful to praise law enforcement officers in his public remarks, even as he has noted the feeling in non-white communities that police are “not working with them and dealing with them in a fair way,” as he said earlier this month.

But he has also called for calm, particularly after protests in Ferguson, Mo., turned violent following the Aug. 9 shooting death of an unarmed black 18-year-old by a white police officer. “There is never an excuse for violence against police,” Obama said.

In his 8 1/2 -minute address to the graduating class of new officers, de Blasio avoided any direct reference to the tensions that have been on display recently, praising the new officers and vowing to protect them. He spoke of Ramos and Liu as fallen heroes and “children of God.”

The loudest applause during de Blasio’s remarks came when he said that officers would confront “problems that you didn’t create,” issues that he said included “a still too-divided society,” poverty and illegal guns.

“You didn’t create these problems, but you can help our city to overcome them,” he said. “You can be part of the solution. And that is a blessing, that is a worthy calling.”

One heckler could be heard yelling “You did!” or “You created them!” when de Blasio referenced the problems the officers would face, according to reporters inside Madison Square Garden.

“It is not an easy choice to stand up and to serve people,” de Blasio said. “We praise you for making this choice.”

Against the emotion and drama of the moment, parts of de Blasio’s speech sounded almost technocratic. He boasted, for instance, that the city has spent more than $160 million to put tablets and smartphones in patrol vehicles.

Bratton, who spoke after de Blasio, drew loud cheers as he expressed solidarity with the police: “In my heart and in my soul, I will always be a cop.”

De Blasio and Bratton are scheduled to meet Tuesday with the five leading police unions, some of whose leaders have accused de Blasio of creating an anti-police climate that led to the officers’ slayings.

The fatal shooting of Michael Brown in Ferguson and the chokehold death of Eric Garner, 43, on Staten Island during an arrest in July — and the more recent decisions by grand juries not to indict the officers involved — sparked months of protests against police actions.

De Blasio’s responses to these protests, which included noting how he warned his biracial son about safely interacting with police officers, have divided the city. His admirers say the mayor was simply speaking honestly about a daily reality for non-whites; his critics say it stirred up sentiment against law enforcement.

Ismaaiyl Brinsley, identified by police as the man who shot Ramos and Liu, had posted on social media about killing police officers. Brinsley, who allegedly shot and wounded a former girlfriend in the Baltimore area before taking a train to New York, had a long history of violence, arrests and potential mental health issues, authorities said.

Within hours of the shooting, Patrick Lynch, president of the Patrolmen’s Benevolent Association, said there was “blood on the hands” of de Blasio, an opinion voiced by others inside and outside the department. When de Blasio and Bratton arrived at the hospital where the two officers had been taken, Lynch and others turned their backs — a prelude to the larger demonstration that occurred at Ramos’s funeral.

De Blasio, New York’s first Democratic mayor in 20 years, had campaigned as an unabashed liberal, and his tenure has been closely watched nationally as a test of governance from the left.

As he nears the end of his first year in office, the mayor is a polarizing figure in a diverse city in which Democrats outnumber Republicans by 6 to 1.

A Quinnipiac University poll released in mid-December found that about 47 percent of those surveyed approved of how de Blasio has handled his job. But only 34 percent of whites had a favorable view, compared with 70 percent of African Americans and 47 percent of Hispanics.

It is not unprecedented for a mayor to be jeered at a police graduation — something de Blasio’s office noted in a blast e-mail to reporters Monday morning.

Michael R. Bloomberg, de Blasio’s predecessor, was booed multiple times in his 2003 address to new police officers; Rudolph Giuliani, who served before Bloomberg and who was been a critic of de Blasio’s comments toward the police, got the same treatment at police graduations.