BERLIN (Reuters) - German President Joachim Gauck said on Monday he would not serve a second five-year term, a decision that could trigger a battle between the parties in Chancellor Angela Merkel’s ruling coalition over who should succeed him.

German President Joachim Gauck gives a press statement at the presidential residence Bellevue Palace in Berlin, Germany, June 6, 2016. REUTERS/Hannibal Hanschke

Although the position of president is largely ceremonial in Germany, the selection of the last two heads of state has caused problems for Merkel and it risks dividing her government in the run-up to the next federal election in 2017.

Merkel initially opposed the appointment of Gauck, a 76-year-old Lutheran pastor who played an important role in the peaceful protests in communist East Germany that led to the fall of the Berlin Wall in 1989.

But she was forced to accept him when other parties, including her coalition partner at the time, the Free Democrats (FDP), came together and backed him. Her previous choice for the post, conservative politician Christian Wulff, was forced to resign in 2012 in a financial favors scandal.

There was broad cross-party support for Gauck to serve a second term, but he said on Monday that his age had been a factor in the decision, which he described as “not easy.”

“I’m thankful that I’m well but at the same time I’m aware that the period between the 77th and 82nd year of one’s life is different to the one in which I find myself now,” he said, speaking at Bellevue presidential palace in Berlin.

“I don’t want to presume an energy and vitality for another five years that I can’t guarantee,” he said.

German Chancellor Angela Merkel said she had wished Gauck would serve another term as president, adding that her Christian Democrats (CDU) would hold talks with Bavaria’s Christian Social Union (CSU) as well as others to decide on a candidate.

Paul Nolte, a history professor at Berlin’s Free University, said the search for a candidate would add to Merkel’s problems, which already include dealing with the migrant crisis and souring relations with Turkish President Tayyip Erdogan.

“(Gauck’s) decision means that things are a bit more difficult for Ms Merkel and she now has even more on her to-do list, namely to find a candidate. But the search must not endanger the grand coalition before the federal election in 2017,” he said.

The president is not directly elected by the people, but rather by the Federal Convention, an assembly of members of the German parliament and the same number of delegates sent from state parliaments.

That means that Merkel must win the support of at least one other big party for her nominee. Any party can propose a candidate for president.

Among the people whose names have been mentioned as possible successors to Gauck are Finance Minister Wolfgang Schaeuble, 73, and Foreign Minister Frank-Walter Steinmeier, 60, although both might struggle to win cross-party support. The appointment of either would necessitate a reshuffle of Merkel’s cabinet.

Norbert Lammert, 67, who is president of the Bundestag lower house of parliament, is seen as another possible candidate. There has also been talk in the German media that a woman could be appointed for the first time.

Gauck’s term expires in March 2017, roughly half a year before Germany holds a parliamentary election. Merkel, 61, is widely expected to run for a fourth term as chancellor, although her popularity has dipped following her decision last year to open German borders to hundreds of thousands of refugees.

Agreeing a joint candidate for the ruling conservatives and Social Democrats (SPD) could signal to voters that Merkel’s ‘grand coalition’ - traditionally a partnership of last resort in German politics - could continue after the general election.

But the SPD, which has sunk to post-reunification lows in opinion polls, may be reluctant to send such a signal. And agreeing a candidate between the CDU and the CSU could also be difficult given the Bavarian party’s withering criticism of Merkel’s migrant policy.

German presidents serve five-year terms and can only be re-elected once. They are considered a moral authority and represent the country at official gatherings and on issues of international law. They can also dissolve the parliament.