Former US President Barack Obama, in a first speaking event in Europe since leaving the White House in January, received an exuberant welcome in the German capital on Thursday as he took part in a public debate with Chancellor Angela Merkel.

Obama made a plea for international engagement as he told an audience of tens of thousands in Berlin that "we can't hide behind a wall".

"In this new world we live in, we can't isolate ourselves. We can't hide behind a wall," Obama said, sitting on stage next to Merkel in front of the Brandenburg Gate at an event that's part of "Kirchentag", a multi-day meeting sponsored by the Protestant church in Germany.

Security was tight, with police helicopters patrolling the skies and snipers with balaclavas watching the scene from rooftops, Politico reported. 

Obama praised Merkel as someone who had done "outstanding work", and defended his own presidency and the values of liberal democracy that both he and the German leader championed.

Obama made the comments as his successor Donald Trump, in Brussels for his first NATO leaders summit, was meeting with European Council leaders Donald Tusk and Jean-Claude Juncker. 

Obama addressed a rapt crowd of Germans lining the streets from blocks away, some holding signs like, "Welcome Home", "You're Looking Great", and "Du Bist Ein Berliner" (You are a Berliner).

The former US leader attended the event at Merkel's invitation — there's no foreign leader that he was closer with during his time in the White House — and she's hoping for a boost from his still sky-high popularity in Germany in her own re-election campaign in the fall. 

Obama warned against leaders who don't question themselves.

"If I become so convinced that ‘I'm always right'," Obama said, "the logical conclusion of that often ends up being great cruelty and great violence."

Merkel had breakfast with Obama in Berlin before the event, and she was set to fly to Brussels later Thursday to have dinner with Trump.