Meet the new German government, same as the old German government.

At least that's the plan of Chancellor Angela Merkel and her political allies, who Friday crafted a deal aimed at ending Germany's 3 1/2-month political crisis.

It may appear an odd strategy, given that German voters gave the previous government the boot.

All three parties making up the last grand coalition — the Christian Democrats (CDU), the Christian Social Union (CSU) and the Social Democrats (SPD) — ended up with historically low returns in last September's federal elections.

But with snap elections looming after the conservatives tried and failed to reach a deal with several other German parties, the old partners were pressured by the German president — and ultimately, the public — to join together one more time.

They avoided the lengthy public spectacle of earlier failed talks, which took place in November, and limited their negotiations to a single week in Berlin with an agreed-to — and largely observed — news blackout. Final talks began at 8 a.m. on Thursday and lasted 24 hours.

Looking the worse for wear after the marathon session, Merkel, her CSU counterpart Horst Seehofer, and SPD leader Martin Schulz all praised each other and their parties' negotiators for persevering.

"I wasn't certain it would work," Merkel told reporters. "The only thing clear to me is that that was a pretty difficult task but ... we kept telling each other we wanted to find a way forward and that's why we succeeded."

Schulz thanked Merkel and Seehofer for their willingness to compromise, even though for months, he had openly rejected joining with them, vowing to make his party the main opposition party that would keep the chancellor in line.

On Friday, he defended his and other SPD leaders' 180-degree turn.

"At a time when [German] society is drifting apart, we wanted to hold the society together," Schulz told reporters.

Hurdles still remain.

The SPD membership will vote on the proposed deal on Jan. 21, and their approval is by no means a given, says Daniela Schwarzer, director of the German Council on Foreign Relations.

The SPD "referendum will, in fact, be a hard thing to win," Schwarzer tells NPR. "If we think back to the election night, when Martin Schulz announced he would never enter into a government with Angela Merkel — and now he tries to convince his party base of just that — it shows the political challenges."

SPD Parliamentarian Hilde Mattheis, who opposes a grand coalition, told the daily Schwaebische Zeitung that the mood in her party "is still very fragile."

If the SPD enters the government, she said, it will be handing the main opposition role in parliament to the far-right Alternative for Germany (AfD). That is a big concern among many German politicians, given AfD was the third largest vote-getter after the conservatives and the Social Democrats.

Being the largest opposition party in the German parliament means AfD will get to head a number of parliamentary committees and will receive public funding and other tools through which to promote its anti-Islam and anti-immigration political agenda.

"This will change the political debate in Germany," Schwarzer said. "And that's something that Germany really has to prepare for."

AfD leaders wasted no time tweeting their displeasure over the grand coalition deal and its first-ever cap on asylum seekers. Merkel and her allies agreed to a total yearly maximum of 220,000 people. In addition, following the passage of a new law next summer, up to 1,000 family members of refugees per month would be allowed to come to Germany.

"Unbelievable," tweeted AfD parliamentary group leader Alice Weidel, calling the proposed limit a "farce." She wrote: "How does the [Grand Coalition] plan to enforce an upper limit WITHOUT border security, our proposal for which was categorically rejected?"

The 28-page coalition deal also includes agreements on a variety of other topics, like emissions standards, more federal oversight over German education and increasing social welfare benefits.

Seehofer told reporters this grand coalition would be different than the last one, and said the deal highlights that — for example, by including a basic pension guarantee. "We learned during the election campaign — unfortunately too late — that having this basic guarantee was suddenly a top issue for people again," he said.

The markets rallied at the news of the prospective deal and the euro jumped to a three-hear high. Many of Germany's international allies congratulated Merkel and the other governing coalition leaders.

French government spokesman Benjamin Griveaux called the agreement "good for Germany, good for France and good for Europe." Prime Minister Boyko Borissov of Bulgaria, which holds the rotating European presidency, said he hoped "that this process will come to an end soon because it will be for the benefit of all.

"All the topics that we raise also depend on the cooperation with Angela Merkel," Borissov said. "We are waiting on this quite impatiently."

But Schwarzer says Friday's deal is only a partial victory for Merkel, who has been politically weakened by her refugee policy and the mediocre election results.

"To some extent, it is clear that the Merkel era will come to an end," Schwarzer says, adding Merkel isn't likely to run again. "So the question, for instance, will be whether she will stay for the whole term or whether she will actually build a successor and hand over to that person."

Seehofer predicted a new government could be in place before April, if the Social Democrats give Schulz a green light later this month.

Copyright 2018 NPR. To see more, visit http://www.npr.org/.