There was an almost audible sigh of relief from Europe's capitals on Sunday night when the German Social Democrats (SPD) voted for formal negotiations with Angela Merkel's Christian Democratic Union and Bavarian sister party the Christian Social Union. Failure to endorse the proposed plan for government would have thrown Europe into another existential crisis it could ill afford.
But it was hardly the endorsement Social Democrat leader Martin Schulz had hoped for. Only 362 of the 642 delegates at the special party conference in Bonn endorsed the compromise reached two weeks ago.
The vote was on a knife-edge and Schulz was hardly confident when he addressed his comrades on Sunday afternoon.
It was not a bravura performance: "Schulz fails to reach the heart of the delegates," wrote the otherwise supportive newspaper S-ddeutsche Zeitung on its website immediately after his address. With friends like that who needs enemies?
It was the survival of the party -- not Schulz's rhetoric -- that saved the embattled leader. After polling a mere 23% in Federal elections in September the SPD has sunk even lower in recent opinion polls. The likelihood of another defeat in new elections in March almost certainly made the difference.
Schulz originally wanted the party to regain strength in opposition after five years of uneasy partnership with Angela Merkel. The election result was a historical low for a party that used to win close to 40% a decade ago.
But after negotiations between the Greens, the FDP (free-market liberals) and Merkel's CDU/CSU collapsed, the SPD were forced into negotiations.
These talks resulted in agreement on stronger European cooperation and integration and lower health contributions for employees: both red-line issues for the Social Democrats. In return, the Christian Democrats effectively were reportedly promised that the number of refugees coming into Germany would be far lower.
Merkel's party lost many votes to the far-right AfD after a 2015 decision to take in close to one million Syrian refugees. Both SPD and CDU/CSU agreed to greater contribution to the EU budget and support for French President Emmanuel Macron's plans for financial integration.
The result of the SPD vote is not the end of the process. The parties still have to make a formal agreement. But that is just that -- a formality.
Sunday's vote effectively paves the way for another four years of coalition government headed by Angela Merkel.
Whether the previously unflappable German Chancellor is able to return to her position as Europe's most influential politician is an open question. While Merkel and her colleagues have negotiated, French President Emmanuel Macron has temporarily taken over the role of Europe's foremost politician.
Merkel's demise has been predicted on many occasions. Every time she has defied her critics and emerged stronger. Whether she will do so again, who knows?
In a wider perspective, the SPD/CDU agreement to make greater contributions to the EU budget means that the new German government -- possibly with Schulz as foreign minister -- will be more principled and less likely to undermine the European project. This, most of all, will alarm Britain -- currently trying to negotiate a series of favorable concessions as it hammers out its Brexit deal with the European Union.