
Barack Obama received a rock-star welcome in Berlin as he appeared at a public debate Thursday with Chancellor Angela Merkel, whom he praised as one of his 'favorite partners' during his presidency.

Obama's trip comes at the same time President Trump is making his inaugural excursion to Europe as president, visiting the European Union and NATO Thursday.

Merkel will leave Obama's side to go visit with NATO leaders in Brussels, including Trump.

Scroll down for video

President Obama surfaced Thursday in Germany for an appearance alongside German Chancellor Angela Merkel, where he railed against the Trump administration's plan to build a Southern border wall

Former American President Barack Obama (right) smiles as he hands over a set of headphones to German Chancellor Angela Merkel

German Chancellor Angela Merkel (left) was criticized by some for inviting former President Obama (right) to Germany, as they called it a publicity stunt to attract votes for her election this fall

Without using President Trump's name, President Obama criticized his successor's plan to build a border wall

Former President Obama (left) and German Chancellor Angela Merkel (right) greet the large crowd gathered to hear them speak in front of Berlin's Brandenburg Gate

Thursday's event with President Obama (middle right) is the first of two events where Angela Merkel (center left) will be with an American president. She meets with President Trump later on Thursday in Brussels

Germans hold signs as they attend an event that attracted former President Obama, who sat alongside German Chancellor Angela Merkel

Crowds packed the streets of Berlin for the opportunity to see the former American president speak alongside German Chancellor Angela Merkel

President Obama's appearance with German Chancellor Angela Merkel in Berlin was set before the iconic Brandenburg Gate

Attendees at a speech Thursday in Berlin with German Chancellor Angela Merkel and former U.S. President Barack Obama hold up a 'We Love Obama' sign

Security was tight in front of the German capital's iconic Brandenburg Gate, where Obama and Merkel appeared on a podium before thousands of people attending a gathering marking the 500th anniversary of the Protestant Reformation.

Police helicopters patrolled the skies and snipers with balaclavas watched the scene from nearby rooftops.

After lauding Merkel as someone who had done 'outstanding work,' Obama launched a defense of his own presidency and the values of liberal democracy championed by both leaders.

Citing the rise of nationalism and xenophobia in parts of the world, Obama told the crowd that 'we have to push back against those trends that would violate human rights or suppress democracy or restrict individual freedoms.'

In a veiled reference to his successor Donald Trump, Obama also spoke of the need to see development aid and diplomacy as essential aspects of national security policy.

'We can't isolate ourselves. We can't hide behind a wall,' he said, to cheers from the audience.

Merkel, who has taken political heat for her open door policy on refugees, including from Trump who called it a 'catastrophic mistake,' got reassurance from Obama.

'In the eyes of God, a child on the other side of the border is no less worthy of love and compassion than my own child,' Obama said. 'You can't distinguish between them in terms of their worth or inherent dignity.'

Obama also talked about how leaders also had to be responsible for taking care of their own people, explaining that more needed to be done for people in their own countries so they didn't want to leave.

He also defended his signature health care legislation, the Affordable Care Act, nicknamed 'Obamacare.'

'My hope was that I was able to get 100% of people health care while I was president. We didn't quite achieve that, but we were able to get 20 million people health care who didn't have health care,' Obama said.

'Certainly I have some regrets,' he continued. 'Obviously some of the progress that we made is now in peril ... but the point really is for those 20 million people, their lives have been better.'

Obama also talked generally about his leadership philosophy.

Former President Obama (left) gives a wave to the large crowd gathered to see him speak in Berlin alongside German Chancellor Angela Merkel (right)

Former U.S. President Obama (pictured) grins as he participates in a discussion with German Chancellor Angela Merkel, one of the world leaders he bonded with while serving as president

Former President Obama (left) cheeses for the camera as he stands alongside German Chancellor Angela Merkel (right) in Berlin on Thursday

Former President Obama appeared in Berlin Thursday and spoke about health care, refugees and dismissed President Trump's plans for a border wall between the U.S. and Mexico

The event with President Obama (center) and Angela Merkel (right) was to mark the 500th anniversary of the Protestant Reformation. They stand alongside theologian Heinrich Bedford-Strohm (left)

'I often say that in politics or at least what I used to say about the presidency is that I saw myself as a relay runner,' he said. 'I would take the baton and I would run my leg of the race. and then I'd pass along the baton to someone else.'

'And again that's part of the reason why I'm so interested in talking to young people today, because each generation tries to make progress knowing that what we do is not going to be perfect is not going to solve every problem,' Obama added.

Since leaving office in January, Obama has spoken at several public events, which usually center around political discussions with young people.

Merkel, who hosted Obama at the same spot four years ago, was due to travel to Brussels later Thursday for a meeting with leaders of fellow NATO member states, including President Trump.

Trump will also lunch with France's new leader, President Emmanuel Macron, who won over far-right candidate Marine Le Pen.

Thursday's appearance with Obama was criticized by some German opposition politicians as a publicity stunt ahead of September's general election, in which Merkel aims to win a fourth term.

How Obama and Trump ended up in Europe on the same day was a calendar 'quirk,' as CNN put it, with Obama being invited to speak by the German evangelical protestant church a year ago, before Trump was even elected.

'When we agreed to do this, they had not yet set the Trump schedule, we did not in fact know he would be there when we made this decision,' an Obama foundation official told CNN.