De Blasio’s speech at the protest, called “Hamburg Shows Attitude,” reflected a similar theme of citizens and localities defying the policies of the national government, specifically on issues such as climate change and marriage equality.

“American cities are signed on to the Paris Accords. We will do it ourselves,” de Blasio said at the rally, according to tweets from his spokesman, Eric Phillips. He and other mayors from across the United States have vowed to uphold the Paris agreement, sidestepping Trump after he withdrew the country from the climate deal.

On achieving marriage equality in the United States, de Blasio said that “it wasn’t the choice of some politicians, but the people made it happen.”

Though unpopular with law enforcement back home, de Blasio was applauded by Hamburg police as he commended them at the rally.

De Blasio left for Germany the day after Officer Miosotis Familia was fatally shot while sitting in a police vehicle in the Bronx early Wednesday morning. His trip, announced in a brief news release issued just hours before his Thursday evening flight, immediately raised questions from political opponents and from New York City’s police union, which has had a strained relationship with the mayor.

“You’ve chosen to leave while the city is mourning. I just don’t understand what he’s thinking,” Ed Mullins, president of the Sergeants Benevolent Association, told The Washington Post.

Mullins said de Blasio’s job is in New York City, not abroad.

“It’s not because he’s playing an intricate role in solving world politics and world peace and all these issues. As mayor of New York, you really have no role in global politics,” Mullins said. “Where you do have a role is in the city of New York, and in the city of New York right now, a police officer is assassinated.”

Watch more!

The Sergeants Benevolent Association tweeted Friday about police officers who’ve been injured in a series of violent, anti-capitalist protests surrounding the G-20 summit.

“So far 160 police officers have [sic] injured by protesters at this year’s G20 summit,” the organization said. “Whose side are you on Mr. Mayor??”

De Blasio’s combative relationship with New York City police stretches back to his 2013 campaign, in which he heavily criticized the police department’s “stop and frisk” tactic. Police union officials, accused de Blasio of fueling anti-police sentiment.

Tensions boiled over in December 2014 after two Brooklyn police officers were shot to death while sitting in their squad car. Later that month, hundreds of police officers outside Christ Tabernacle Church in Queens turned their backs as de Blasio spoke at the funeral of Rafael Ramos, one of the slain officers.

The rift has yet to show signs of closing even as the mayor’s office announced a $1.3 million investment to install bullet-resistant door panels and other layers of protection on all NYPD vehicles. Mullins said officials have been slow to add safety measures to the city’s 4,000 police vehicles. A little more than 2,000 vehicles have been outfitted with bullet-resistant door panels, and the city plans to have the protections on every patrol vehicle by the end of the year, according to the mayor’s office.

De Blasio’s political opponent, Republican state lawmaker Nicole Malliotakis, has accused the mayor of ignoring the city’s problems to place himself on an international stage.

“While #NYC’s subways crumble, sex crimes increase double digits, litter on streets pile up & the number of homeless soars … #G20,” she wrote in a tweet that included a Photoshopped picture of de Blasio holding a plate of sausages and sauerkraut.

The New York Post delivered a stern message on its front page Friday: “DON’T COME BACK!”

(New York Post)

Donald Trump Jr. also weighed in on Twitter:

De Blasio’s press office did not respond to a request for comment, but the mayor said during his regular radio talk on WNYC on Friday that he’s able to attend to local issues regardless of where he is. He said local and state officials in Hamburg invited him about 10 or 12 days ago to talk about climate change, immigration and other issues.

“They invited me as a colleague. They wanted to, I think, represent the fact that there are a variety of views in the United States … particularly on climate change,” de Blasio said, adding that his role is to show that issues such as climate change have to be addressed locally.

De Blasio said he meant to announce the trip earlier, but he first wanted to make sure it would not prevent him from attending Familia’s funeral on Tuesday. De Blasio returns Sunday.

Organizers of the “Hamburg Shows Attitude” protest said the New York mayor was invited to be the keynote speaker because of his political views that contradict Trump’s nationalist policies.

“Bill de Blasio is the mayor of a city that stands like no other on our planet for liberty, internationality and the coexistence of different cultures — with all the challenges involved,” according to the event’s website. “For example, de Blasio is committed to social equality, minority rights and climate protection. New York is a world symbol of freedom and diversity. Right now, it is important to stand together, regardless of nationality, for values such as cohesion and nonviolence, where they are under such intense pressure around the world.”

Trump was the target of many protests in Hamburg, where German Chancellor Angela Merkel hosted him and other world leaders for the two-day G-20 summit, which ended Saturday.

German security forces in riot gear clashed with thousands of anti-capitalist protesters Thursday, using water cannons and pepper spray to clear a march that included a militant group with anarchist sympathies, The Post reported.

Riots continued when the summit began Friday; protesters burned cars and blocked roads. First lady Melania Trump was forced to miss an event with the spouses of other world leaders because protesters blocked her from exiting the guesthouse where she and the president are staying.

Mark Berman, Christian Carly, Isaac Stanley-Becker and Karen Tumulty contributed to this report, which was originally posted on July 7, 2017 and has been updated.