New York City Mayor Bill de Blasio was booed and called a traitor at a New York Police Department graduation ceremony, Fox News Latino reported.

Recently, people have blamed the mayor for the killings of two NYPD officers, who were slain in December in retaliation for the deaths or two black men at the hands of police officers. Neither officer was charged.

Some members of the public blamed de Blasio for causing stoking anti-police sentiment, which they say caused the two officers to be killed.

Yet, as he welcomed the newest cops to New York's force, he praised the police department for doing a good job, the New York Post reported.

"Generations of NYPD officers come forward and, one after another, have done better and better and better and made this city safer and safer," de Blasio told the 884 officers at the graduation ceremony in Madison Square Garden.

"And now the baton is being passed to you to continue that progress," he added. "And the people of this city need it. So you'll be hitting the ground running later this week, out patrolling and protecting the people of this city."

As de Blasio spoke to the crowd, some turned their backs to him as he approached the stadium in protest for officers Rafael Ramos and Wenjian Liu, the two cops who were killed in their squad car.

"Let's be honest about the realities of our society. You will confront all the problems that plague our society – problems that you didn't create," de Blasio said.

As the mayor continued his speech, he added that through all the chaos, the city's crime rate has dropped by 5 percent.

"We need you to keep this city safe," Police Commissioner Bill Bratton said to the new officers. "We're in a very difficult time at this time, in this country, in this city, in this department."

The mayor left the arena without taking any questions.