Mayor de Blasio flew all the way to Hamburg, Germany, to praise that city’s police in a speech — while cops back home continued to mourn, without him, the assassination of one of their own in The Bronx.

“Our right to protest is directly related to the fact that our police protect us,” Hizzoner told a crowd of thousands at the outdoor Hamburg Shows Attitude rally protesting the G-20 summit Saturday. “So help me by joining in applause and thanks for the police,” he said as the crowd cheered.

“There have also been great acts of bravery and restraint,” he said. “Remember, our police are working men and women, too.”

But Hamburg police weren’t feeling the love, despite the praises of “Burgermeister de Blasio.” By Saturday night — after two days of rioting — more than 200 Hamburg cops had been injured by a rowdy minority of bottle- and firebomb-tossing protesters, according to CNN.

And back home, the mayor missed an evening vigil honoring slain NYPD Officer Miosotis ­Familia at the 46th Precinct station house where she worked in The Bronx.

Familia, 48, a mother of three, was shot in the head early Wednesday by a cop-loathing ­parolee as she sat in a police command vehicle.

“It’s disgraceful that the mayor is anywhere but at this ceremony right now,” vigil attendee Maria Rinaldi, 53, of University Heights, told The Post.

“I get where he’s at right now,” said precinct neighbor Caesar Montez, 61. “But this is your city. You need to be here when a tragedy like this happens.”

De Blasio gave two speeches Saturday during his all-expenses-paid junket to Hamburg.

The first was in the morning, at the city’s Thalia Theater, where he avoided any mention of filth or delays as he praised the New York City subway system, calling it a metaphor for a harmonious society.

Riding the subways are “people of all faiths and people of all backgrounds,” he said.

“You have the rich and the poor, people of all faiths and all backgrounds, cramped in close together.

“And I like it as a metaphor because it’s not perfect, it’s not necessarily the way you want to live, to be the sardine in the sardine can. But what you notice is there is a working harmony.”

The mayor spent much of his second outdoor rally speech ­distancing himself from US conservatives.

“My nation isn’t broken, but my nation is going through an identity crisis,” he said. “It’s on its way somewhere, and I know it’s somewhere good because I see what happens in the neighborhoods in my city . . . I see the process of change underway.”

De Blasio was accompanied at both speeches by his 19-year-old son, Dante, a Yale University ­undergrad who is spending the ­summer in Berlin.

After the rally, de Blasio gave a series of softball interviews to local media, who asked him how much German he could speak and how he and Dante were ­enjoying their visits.

But he refused to take any more questions when a Post reporter approached to ask for a response to the criticism he has received — from police, political opponents and New Yorkers — for leaving the city just one day after Familia’s assassination to grandstand on a global stage.

“It seems the mayor hasn’t learned anything from the men and women [in blue] who turned their backs on him in the past,” said Ed Mullins, president of the Sergeants Benevolent Association — in a reference to angry cops turning their backs on the mayor at past events.

“No one in uniform is surprised” by de Blasio’s show of disrespect, said Pat Lynch, president of the Patrolmen’s Benevolent Association.

The mayor had jetted off to Hamburg on Thursday, missing an NYPD swearing-in ceremony for 524 new recruits.

He had kept his travel plans ­secret until just hours before his departure, explaining through a spokesperson that he wanted to be sure that he wouldn’t miss the Familia funeral, to be held Tuesday. The mayor is due to return to New York on Sunday.

Additional reporting by Shawn Cohen