Berlin (CNN) In the early hours of Friday morning, Angela Merkel emerged from marathon talks in Brussels looking exhausted but happy. For the first time in weeks, the German Chancellor had a reason to smile: she finally secured a European Union agreement of sorts on the critical and divisive issue of migration, just in time to keep a simmering mutiny in her coalition government from boiling over.

"Overall, after an intensive discussion on the most challenging issue for the European Union, namely migration, it is a good signal that we agreed a common text," Merkel said after the meeting. "We still have a lot of work to do to bridge the different views."

Though many of the details in the communique were vague at best, its biggest achievement may have been acknowledging that EU solidarity is the only way to avert a repeat of the 2015 migration crisis that saw hundreds of thousands of asylum-seekers flowing uncontrolled into Europe.

By promising to share responsibility -- albeit only on a voluntary basis -- this agreement binds the EU together and offers up a rebuke to the nationalist policies of European leaders like Hungarian Prime Minister Viktor Orban who had warned of an "invasion" of migrants, despite the fact that illegal border crossings are down 95%.

But for Merkel, this wording was key: "Member States should take all necessary internal legislative and administrative measures to counter such movement and to closely cooperate amongst each other to that end."

That's exactly what she needed to keep the critics in her Bavarian sister party, the Christian Social Union, from rebelling -- for now, anyway. Horst Seehofer, the CSU leader and German interior minister, had threatened to trigger a collapse of the government unless Merkel found a way for the EU to allow Germany to push back asylum seekers who had already registered in another EU country.

Merkel delivered and the CSU is already making positive noises.

"The EU summit took a big step towards a better migration policy. Europe stands for humanity towards people in need, determination in the protection of external borders and in the fight against illegal migration, as well as for solidarity with one another," CSU Party Chairman Manfred Weber tweeted. "The EU is showing its capacity to act."

But there are still serious questions as to how -- or whether -- this agreement can be implemented. And Merkel will need concrete results to stave off future challenges to her leadership.

The key concession that Italy demanded was pushing responsibility for Mediterranean rescues to the Libyan Coast Guard including "regional disembarkation platforms" to be established in Africa.

But Libya has not agreed to this proposal, and many observers doubt it can work.

Gerald Knauss of the European Stability Institute -- one of the original drafters of the Turkey-EU migrants deal -- told CNN: "The trouble is no one can explain: Why would any of these countries agree to this? And to do what? Process asylums according to Libyan or Tunisian law? Is it even legal if they are unsafe there. Libya is impossible! It's so unsafe we don't even have embassies there! It's a far-fetched idea."

Libya's government is struggling to maintain law and order, and its deportation centers are rife with human rights abuses and cases of slavery documented by CNN . And it's not clear how dumping rescued asylum seekers on "disembarkation platforms" would be acceptable under EU human rights law.

Even within the EU, the promise to set up "controlled centers" for the "rapid and secure processing" of asylum requests works in theory but not in practical terms -- not least because such centers will only be set up in countries that volunteer to build them. There are expected to be few takers on this offer.

In the meantime, tens of thousands of migrants are still stranded in Greece after Europe closed its borders in 2016, and it's not clear what the EU will do differently to improve this.

While the EU pledged to either resettle or deport 160,000 asylum seekers -- and signed a deal with Turkey to take back any rejected migrants -- only around 30,000 have been resettled across Europe over the past two years, according to the EU Relocation Scheme. Some have been deported back to Turkey but more than 60,000 remain in Greece, according to the UN refugee agency. Many are still living in squalid camps.

The agreement also fails to do anything about the problem of distributing refugees already in EU territory. It uses the word "voluntary" and "shared" quite often but doesn't explain on what basis EU countries will be resettling refugees. Germany's previous suggestion of mandatory quotas for each EU country was bluntly rejected by countries like Hungary and Poland.

Meanwhile, it took Europe more than five days to figure out what to do with more than 200 rescued asylum-seekers who had been stranded on a ship at sea this week. That doesn't bode well for future cooperation.

It also doesn't bode well for Merkel's political future. Her opponents at home are looking at regional elections this year and will be looking for ways to score political points at her expense. And after more than 12 years as Chancellor, Merkel may increasingly find herself fending off more challenges from younger rivals within her own party.

"This can repeat in two weeks, three weeks. There are many political rivals who want to get rid of the Chancellor, so they will study these mistakes and learn from them," warned German political analyst Timo Lochoki.

"If she continues in this style, the incremental nitty gritty, moving ahead a tiny bit at a time, then she can postpone -- but she cannot avert -- political disaster."