Angela Merkel, who faces what amounts to a vote of confidence today. Photograph: Geert Vanden Wijngaert/AP

German chancellor Angela Merkel faces what amounts to a vote of confidence in her leadership today when parliament members and state representatives elect a new federal president.

Political analysts say that both Merkel and her nine-month old government could be forced to stand down if Christian Wulff, a career politician from Merkel's Christian Democratic Union (CDU), loses the vote to Joachim Gauck, a former civil rights activist backed by the opposition Social Democrats and Greens.

The unhappy alliance of the CDU and the liberal FDP has seen its popularity drop from 48.4% to around 35%. Meanwhile, Merkel's personal popularity level has dropped to 39%, the lowest for several years.

The role of federal president is largely ceremonial and the vote to fill the post is normally a low-key affair, involving a special assembly of 1,244 delegates, half of whom are federal lawmakers, and half nominated by state parliaments. The representatives include a selection of celebrities and business figureheads, from paralympic champions to jazz musicians.

This time the stakes for Merkel are high, with her majority in the assembly just 21.

Delegates are expected to largely vote along party lines, so if Wulff does not win it would be a strong indication that Merkel had lost control of her majority.

Since the surprise resignation of the last president, Horst Köhler, over controversial remarks he made about German military involvement in Afghanistan, malcontents in the parliament have viewed the vote as an opportunity to bring Merkel down.

Potential rebels include some within Merkel's party and members of the FDP in former communist East German (GDR) states who view Gauck as a hero.

Gauck, 70, is a protestant pastor from Rostock who proved pivotal in the protest movement which helped bring down the Communist regime of East Germany in 1989. After the fall of the Berlin Wall he headed the archives of the former communist secret police, the Stasi, winning both friends and enemies when he exposed their crimes.

"My conscience would not allow me to vote for anyone other than Gauck," said Tino Günther of Saxony's FDP, who was also part of the opposition movement in the GDR.

"We should be free to vote for whoever we want."

Gauck has been touring towns recently, evoking the spirit of the former protests and delivering speeches about the time he met Martin Luther King, or the story of how his sea captain father was exiled to Siberia accused of spying.

He cuts a much more colourful and morally authoritative character than Christian Wulff, the 50-year-old state premier of Lower Saxony. Polls show that if the public were to be allowed to vote for president, Gauck would win easily.

The vote has caused wide political rifts, particularly between Merkel and the head of the SPD, Sigmar Gabriel, who leaked text messages sent between him and Merkel when deciding who the candidates should be.

A final decision is expected before the end of the day.

Merkel has also been criticised for insisting that the vote should take place along party lines.

Kurt Biedenkopf, a leading member of the CDU, has argued that the decision means the vote has largely lost its legitimacy.

"If it's along party lines, it creates the fatal impression that we're not voting for a new president, but we're making a decision about who is in power," he said.

Two former presidents, Richard von Weizsäcker and Roman Herzog, have voiced similar concerns, which has increased the pressure on Merkel.