A migration deal patched together by European Union leaders early Friday appeared to have won German Chancellor Angela Merkel a respite in the toughest battle of her political career.

EU leaders after nine hours of negotiations agreed to help coastline countries, notably Italy, by redistributing some of the migrants rescued in the Mediterranean, provided they are placed in detention.

In parallel, the EU said it would seek to set up reception centers in North African countries where most migrants rescued at sea would be sent back to. Those centers, called “disembarkation platforms,” will be run together with United Nations agencies that will ensure that people are housed in humane conditions while awaiting repatriation or resettlement to European countries.

This effort is aimed at curbing the migrant influx that fueled the rise of populist parties across Europe, reshaping the political landscape and putting mainstream leaders such as Ms. Merkel under severe pressure.

An expanded version of this report can be found at WSJ.com

Also popular on WSJ.com:

Why the Marine Corps ditched the best offense in history

Deloitte leadership battle leaves CEO’s future in question