Barack Obama is to visit Berlin on his first trip to Europe since leaving office. The former president will be in Germany on 25 May, the same day his successor, Donald Trump, is due in Brussels for a meeting of Nato leaders, in what is expected to be the incumbent US president’s first foreign trip since taking office.

Obama will travel to Germany for the launch of a summer of celebratory events organised by the Protestant church to mark its 500th anniversary.

Whether intentional or not, the simultaneous presence of both men on the same continent will serve to underline the difficulty many Europeans have had in dealing with the concept of Trump as US president, and the great deal of nostalgia that exists for the Obama era.

Obama is due to hold a speech in Berlin and to take part in a live discussion with the German chancellor, Angela Merkel, titled “Actively shaping democracy – taking responsibility at home and abroad”. They will talk on a purpose-built stage in front of Berlin’s most prominent landmark, the Brandenburg Gate.

Obama’s trip follows his acceptance of an invitation sent last May by the bishop of Bavaria Heinrich Bedford-Strohm. More details about the visit are due to be released at a press conference on Wednesday.

There is some irony in the decision to choose the Brandenburg Gate, which stands as a symbol of the cold war and how it was overcome, as the backdrop for the two politicians’ get-together.

In 2008 Merkel intervened to prevent Obama, then presidential candidate, from holding a speech at the 18th century neoclassical arch, saying she did not think it appropriate for him to use a nonpartisan symbol for electioneering purposes. In the end he was forced to hold his speech at the nearby Victory Column. It was attended by a 200,000-strong crowd and was considered one of the high points of his election campaign. He later got the opportunity to speak at the Brandenburg Gate as president in 2013.

This time round it is Merkel who is facing a tough election herself, in the coming September, and there will be many who see Merkel and Obama’s joint appearance as an attempt by him to endorse her chances of a fourth re-election.

Obama’s enjoys high popularity ratings in Germany, and his declaration during his outgoing visit as president to Berlin in November that “if I were German and I had a vote I’d support her,” carry considerable weight.

At the time of his remarks Merkel had not yet officially announced whether she would be running again. Obama added he did not know if his statement “helps or hurts”.

The Protestant church marks 500 years since theologian Martin Luther nailed his 95 theses to the door of a church in Wittenberg, giving birth to the Reformation.

While Merkel is the daughter of a Protestant pastor, Obama’s involvement in the commemorations has taken some by surprise. Although he belonged to a Christian community when he lived in Chicago, he has never cited an allegiance to a specific religion.

He told the traditional annual National Prayer Breakfast at the White House in 2013 that he often turned to the bible for advice as to how he could be a better president, husband and father. In a 2004 interview with the Chicago Sun-Times he said while his grandmother had been a methodist, his grandfather a baptist and his mother a very spiritual Christian, he had not had a structured religious upbringing.

Christina Aus der Au, president of the Protestant Church Days which is organising the event, said Obama’s presence would underline how Protestantism had “not just remained a European affair, but has shaped societies and nations all over the world.”

She added: “President Obama and chancellor Merkel have said that their dedication as politicians is also an expression of their Christian faith...it will be really interesting to hear what the two of them say to us Christians in Europe.”

After Berlin, on 26 May, Obama is to visit Edinburgh where he will address philanthropy and business leaders at a dinner at the Edinburgh International Conference Centre organised by the Hunter Foundation, a charity organisation set up by Scottish billionaire Sir Tom Hunter.

President Trump is due to make his first official visit to Germany in July for the meeting of G20 leaders in Hamburg.

• This article was amended on 18 April 2017. An earlier version said Obama’s 2008 Berlin speech was attended by 100,000 people; at the time police estimated that at least 200,000 had turned up.