By Noah Barkin
BERLIN (Reuters) - The breakdown in trust between Angela Merkel and Sigmar Gabriel can be traced back to June 2010, when the leader of Germany's Social Democrats (SPD) leaked a confidential text message the chancellor sent him to Der Spiegel magazine.
A furious Merkel broke off contact with Gabriel for the months after the exchange, which concerned the choice of a candidate for president. The two eventually patched things up, but the episode reinforced the view in her entourage that the SPD chairman was not entirely reliable.
Merkel, a discreet protestant pastor's daughter from East Germany, looks sure to win a third four-year term in an election on Sunday, making her one of only three post-war leaders to accomplish that feat, after Helmut Kohl and Konrad Adenauer.
Yet there is a strong chance she will be forced into an uneasy "grand coalition" with Gabriel and the SPD.
This right-left partnership between Germany's two big "Volksparteien" (people's parties) worked surprisingly well in Merkel's first term in 2005-2009.
But the sequel is likely to be more fraught, partly because Gabriel is a partisan bruiser but also due to deep ambivalence in his party about joining forces with an arch-rival for the second time in a decade. The SPD came off worst last time.
"For Merkel, governing with the SPD would be much more difficult this time around," said Frank Decker, a political scientist at Bonn University. "From the very start, the SPD will be thinking about the next election in 2017. This could weigh heavily on the coalition."
Popular at home for her steady handling of the euro zone crisis and modest leadership style, Merkel faces major policy challenges if she wins on Sunday.
She must bed down a costly, complex shift from nuclear to renewable energy that has unsettled German industry, ensure the euro zone crisis does not flare up again, and reform an economy that has shown resilience but is rolling towards a demographic cliff due to an ageing population and low birthrate.
In her first two terms she enjoyed good fortune, profiting from controversial labour reforms of her SPD predecessor Gerhard Schroeder, and from European Central Bank President Mario Draghi's promise to do "whatever it takes" to save the euro.
But her luck could run out fast in a new term that is shaping up as a domestic minefield.
CENTER-RIGHT, ANTI-EURO RISKS
If Merkel gets her wish on Sunday and returns to power atop a center-right coalition, she is likely to have only a razor-thin majority in the Bundestag lower house, and a left-dominated upper house that could block major initiatives.
"If Merkel wins a majority with the center-right it is likely to be a lot narrower than before," said Elga Bartsch of Morgan Stanley. "You will have dissenters on European issues. She will not only have to rely on the opposition in the Bundesrat, but possibly also in the Bundestag."
Another threat stems from a new anti-euro party, the Alternative for Germany (AfD), which could enter parliament for the first time, denying Merkel a center-right majority and intensifying disputes over Europe ahead of European Parliament elections next June.
The AfD's rise comes at a tricky time. The German Constitutional Court is weighing the legality of Draghi's bond-buying programme, Greece and Portugal could soon need new bailouts, and the EU is creating an ambitious banking union that may bring new liabilities for German taxpayers.
"If the AfD enters parliament it will change the euro debate in Germany. It will become sharper," a close aide to Merkel told Reuters, requesting anonymity.
Still, the prospect of a divisive "grand coalition" worries Merkel and her conservative allies most.
Unlike in 2005, when SPD heavyweights Frank-Walter Steinmeier, Peer Steinbrueck and Franz Muentefering joined the government, ensuring a degree of discipline, the SPD could split this time, with Gabriel entering the cabinet but the real power in the party remaining outside.
Steinbrueck, the SPD's candidate for chancellor, has vowed not to serve under Merkel a second time, and Steinmeier seems determined to stay in his job as parliamentary floor leader.
"Sigmar Gabriel is perceived to have a track record of changing his mind abruptly without consulting political partners or his own party," said Bartsch. "As a result it may prove more difficult to work with him than with Steinmeier or Steinbrueck."
Hannelore Kraft, the influential state premier of North Rhine-Westphalia and hot favourite to be the SPD's candidate for chancellor in 2017, also has no interest in joining a Merkel-led government in Berlin.
As leader of the SPD in the upper house, she could make life difficult for a grand coalition if she refused to rubber-stamp legislation on issues ranging from taxes to pensions and energy.
Some even see a risk that the SPD could walk out of a grand coalition before its four years are up, allying with the Greens and far-left "Linke", a party it has ruled out as a coalition partner after Sunday's vote.
"There will always be the option and temptation for the SPD to try to find a majority without Merkel," the Merkel aide said.
Forming a grand coalition in the first place will be tough.
Decker believes haggling would last at least two months. "They will be the most difficult coalition negotiations ever," he said.
Gabriel has called a special SPD leadership meeting for September 27, five days after the election, that may offer the first clues about how the party will position itself.
As its price for partnering with Merkel, the SPD is expected to insist on a nationwide minimum wage to lift the working poor and tax hikes for top earners in the name of social justice. The CDU opposed both steps during the campaign as bad for jobs.
If Social Democrats do well, winning close to 30 percent of the vote, it could push for both the finance and foreign ministries, with Gabriel taking one of those roles.
Merkel may be reluctant to agree, recalling the SMS row in 2010, when she stonewalled Gabriel on his proposal that East German dissident Joachim Gauck become president. But if she wants to stay in power, she will have little choice.
(Reporting by Noah Barkin; Editing by Paul Taylor)