BERLIN (AFP, BLOOMBERG) - German Chancellor Angela Merkel’s conservatives and the Social Democrats (SPD) sealed a deal on Wednesday (Feb 7) on a new coalition, officials close to the talks said, potentially ending four months of political standstill in Europe’s top economy.

“We have a coalition agreement that will do a lot of positive things for a lot of citizens,” Dr Merkel’s chief of staff and acting finance minister Peter Altmaier told reporters, after he emerged from more than 24 hours of often contentious talks.

“And now we all want to take a shower because we negotiated long and hard in these last hours.”

The SPD will get the finance, foreign, and labour ministries, according to people familiar with the talks. German media said Dr Merkel’s Christian Democrats (CDU) will fill the defence and economy posts, and the CDU’s Bavarian sister party Christian Social Union (CSU) will get the Interior Ministry.

The DPA newswire reported that Hamburg Mayor Olaf Scholz will become Finance Minister. The deal was worked out by a core of about 15 leaders and must now be approved by a broader group of roughly 90.

The breakthrough will come as a relief to Germany’s European Union partners as the bloc faces tough negotiations on migration and Brexit.

Related Story Key points agreed in German coalition pact

Dr Merkel, Europe’s most experienced leader, has seen her standing at home and abroad weakened by the longest stretch of coalition-building in the country’s postwar history.

Related Story Key moments in Germany's political stalemate

The agreement for a renewed “grand coalition” comes after days of marathon talks in which negotiators from all three parties haggled over everything from foreign policy to labour issues and healthcare.

Germany has been stuck in political limbo since September’s inconclusive general election saw mainstream parties bleed support to the far-right AfD, which tapped into anger over Dr Merkel’s liberal refugee policy.

Dr Merkel, in power for over 12 years, at first tried to cobble together a novel three-way coalition with the Greens and the liberal Free Democrats, but those efforts collapsed in November.

Faced with snap elections that could further boost the AfD or the prospect of heading an unstable minority government, she opted to woo back the SPD – her junior partner for two of her three terms since 2005. SPD leader Martin Schulz then abandoned his post-election vow to renew the party in opposition – a U-turn that angered many.

Dr Merkel’s fate now lies in the hands of the SPD, as Mr Schulz has promised to give his party’s 460,000 members the final say on whether to accept the coalition pact.

Observers expect the referendum to be tight, with the SPD’s left and youth wings fiercely opposed to another four years governing in Dr Merkel’s shadow. The party’s fiery youth chief Kevin Kuehnert has led a campaign against another “GroKo”, as the grand coalition is known.

The referendum will be held by postal ballot, with the result expected to be announced in early March. A green light could see a new

Merkel-led government in place by the end of next month. A thumbs-down could spell disaster for Dr Merkel and Mr Schulz, whose political lives hang in the balance, and see the country headed for fresh elections.

With so much at stake, Mr Schulz was determined to extract as many concessions as possible from the tortuous coalition talks to win over sceptics.

While details of the final agreement have yet to be released, former European Parliament chief Schulz has put a fairer Europe at the heart of his efforts, insisting that Berlin must join French President Emmanuel Macron’s push to deepen eurozone integration.

In a draft version of the coalition pact seen by AFP, the parties agreed to support Mr Macron’s reform drive and tentatively backed his idea of a eurozone investment budget.

On the hot-button topic of migration, the two camps said they would aim to limit the annual intake to 180,000-220,000 people, a key CSU demand. The SPD however won assurances that family reunifications for refugees would resume in August, albeit restricted to 1,000 people a month.

It was not immediately clear how the final sticking points in the negotiations were resolved, such as the SPD’s insistence on limiting short-term contracts and overhauling the two-tier healthcare system.

On defence spending too, both sides remained at odds as the finish line neared with the conservatives more open than the SPD to raising military spending closer to Nato targets, as pushed for by US President Donald Trump.

But the protracted haggling has left its scars, and surveys suggest both camps have much to fear from fresh elections in case of a “no” vote from SPD members.

A recent Insa poll found that support for the CDU/CSU had fallen from 33 to 30.5 percent, while the SPD slipped from September’s historic low of 20.5 per cent to 17 per cent. The AfD meanwhile scored a record 15 per cent.