The tension between New York Mayor Bill de Blasio and the city’s police department continued to suffuse interactions between the mayor and the police, casting a shadow over yet another public event in which he spoke directly to officers.

De Blasio, along with William Bratton, the police commissioner, stood on a stage Monday morning inside Madison Square Garden to honor the 884 cadets who were graduating from the New York Police Department’s academy. Much of the attention paid to the ceremony focused on how officers would respond to de Blasio, something that has cropped up in very high-profile ways since two police officers were gunned down in Brooklyn.

While de Blasio was given a public rebuke from some in the crowd Monday, the response was much smaller than the hundreds of officers who turned their backs while the mayor spoke during the funeral of Officer Rafael Ramos on Sunday. As de Blasio rose to speak Monday, he was greeted with applause and some boos from the crowd. And about a dozen attendees stood and turned their backs to him, echoing the response at the funeral and at the hospital after the Brooklyn shooting.

De Blasio’s nine-minute address on Monday did not directly touch on this tension, focusing instead on praising the cadets for “choosing what is a noble calling.” Bratton, who said he wanted to address the cadets “cop to cop,” was greeted more warmly by the crowd.

The loudest applause during de Blasio’s remarks came as 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 created them!” as de Blasio spoke of these problems, 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.”

It is not a novelty for a mayor to be booed at this particular event, something de Blasio’s office noted on Monday morning. Michael R. Bloomberg, de Blasio’s predecessor, was booed multiple times during his 2003 address to new police officers; Rudy Giuliani, who served before him and who was been a critic of de Blasio’s comments toward the police, was also booed at different police graduations.

”It’s a rambunctious crowd,” Raymond Kelly, the police commissioner under Mayor Michael Bloomberg, told the New York Times in 2003. ”Mayors have always gotten a little static in Police Department graduations; certainly Mayor Dinkins and Mayor Giuliani did. It comes with the territory.”

On Monday, de Blasio praised Ramos and his partner, Wenjian Liu, during his remarks, which came nine days after the two officers were fatally shot as they sat in their police car. This shooting brought national attention to the rift between de Blasio and the police. Within hours of the shooting, Patrick Lynch, president of the police union, said there was “blood on the hands” of de Blasio, an opinion voiced by others inside and outside the department.

The deaths of Michael Brown in Ferguson, Mo., and Eric Garner on Staten Island over the summer — 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 son about safely interacting with police officers, have drawn condemnation from Lynch and some others.

Ismaaiyl Brinsley, identified by police as the man who shot Ramos and Liu before killing himself, had posted on social media about killing police officers. Brinsley had a long history of violence, arrests and potential mental health issues, authorities said.