New York City Mayor Bill de Blasio defended his decision to join protesters at the G-20 summit in Germany a day after an NYPD cop was assassinated in the Bronx.

De Blasio appeared on the "Ask the Mayor" segment on WNYC's "The Brian Lehrer Show" Friday, calling in from Hamburg. The mayor departed Thursday evening to attend protest events, keeping hush about his plans until hours before he left.

De Blasio told Lehrer the government of Hamburg invited him to come about 10 to 12 days ago and he was going to announce the trip earlier this week.

"They wanted, I think, to represent the fact that there are a variety of views in the United States on how to proceed on the big issues that face this planet, particularly on climate change," de Blasio said.

De Blasio continued to attack Trump, with the mayor saying, as the "leader of the biggest city in the country," he has the responsibility to represent the U.S. differently from the president.

"We are not going to be intimidated by President Trump and we are not going to turn away from our values," de Blasio said. "I have said many times this is not someone you get something done by compromising with or yielding to. He only understands strength and we have to show strength."

De Blasio is expected to attend several events surrounding the G-20 summit in the next two days, the mayor's press secretary Eric Phillips wrote on Twitter. De Blasio will also be a main speaker at the Saturday demonstration "Hamburg Zeigt Haltung," or "Hamburg Shows Attitude."

The trip will also include a visit with his son, Dante, who is currently in Berlin for a summer internship, The New York Post reported.

MELANIA TRUMP BLOCKED BY G-20 PROTESTERS FROM LEAVING GERMAN GUEST HOUSE

The mayor's abrupt departure for Germany left him skipping a swearing-in ceremony for 524 new NYPD recruits. It also came soon after NYPD Officer Miosotis Familia was shot in the head and killed while sitting in her police vehicle in the Bronx. De Blasio said he decided to take the trip once he knew it wouldn't coincide with the funeral service.

"Obviously I did not want to do anything until we knew when the services would be," he said. "Her services will be early next week so then that's when it was finally time to announce I was going to accept this invitation."

Many New Yorkers and politicians slammed the mayor's decision to leave the city. Assemblywoman Nicole Malliotakis, one of de Blasio's Republican opponents in the upcoming mayoral race, blasted his trip with a comic photo.

"While #NYC 's subways crumble, sex crimes increase double digits, litter on streets pile up & the number of street homeless soars... #G20," Malliotakis tweeted Thursday night with a photoshopped image of de Blasio drinking beers and eating bratwurst.

"The photo is funny but the issue is serious. Our mayor is neglecting his basic responsibility of managing the city," Malliotakis told the New York Post.

TRUMP, PUTIN SET FOR FIRST FACE-TO-FACE MEETING DURING G-20 SUMMIT

"As the city mourns, its leader flees," said Ed Mullins, the head of NYPD sergeants union. "And then he wonders why he has a problem with the police. A real leader stays with the city in this time of hardship."

Donald Trump Jr. also called out the mayor for leaving New York City while its "education, infrastructure etc rots under his 'progressive' stewardship!"

De Blasio will travel with three staffers and the cost of the trip will be covered by event organizers, Phillips told The New York Daily News.

Thousands of anti-capitalist protesters clashed with police in Hamburg on Thursday as Trump and other world leaders arrived for the summit. German police said 29 protesters were detained and 111 police officers were wounded, including three officers who were hospitalized. The protests are expected to continue through the weekend.