Migrants inside Greece gather at a makeshift camp on March 17, 2016, at the Macedonian border near the Greek village of Idomeni, where thousands of asylum seekers are stranded by the Balkan border blockade. (Sakis Mitrolidis/AFP/Getty Images)

Will the real Angela Merkel please stand up?

The German chancellor has been hailed as a global humanitarian whose pledge of unlimited sanctuary became a beacon of hope for the desperate fleeing war in the Middle East. She also has been called Europe’s “decider,” the go-to person for managing momentous challenges such as the Greek debt crisis and newly belligerent Russia.

But as she races to strike a deal in Brussels by Friday aimed at containing Europe’s migrant crisis, Merkel now casts doubt on both assumptions about her.

She finds herself as a principal advocate of an accord that, in exchange for cash and concessions to Turkey, would send back virtually all migrants crossing the ­Aegean Sea to find shelter in Europe. If reached, critics say, any deal would amount to an imperfect, immoral and potentially illegal solution that would corral refugees in Turkey, a nation plunging deeper into instability and violence.

[7 things to know about the incredibly complicated migrant crisis]

Europe’s borders are slamming shut and leaders recently announced a preliminary deal under which everyone who crossed the sea to reach Greece would be sent back to Turkey. That hasn’t stopped the flow of migrants streaming into Lesbos, yet. (Griff Witte,Jason Aldag/The Washington Post)

That stinging salve would go on top of a crisis that some say is partly of Merkel’s making. Last year, she famously declared that Germany would set “no limit” on the number of refugees it takes in, a statement some say was an open invitation for even more migrants to reach Europe or die trying.

As a result, Merkel’s stature is taking a beating. She is making a last-ditch call for unity after a number of nations in Europe openly defied her call for a coordinated response to the migrant influx. Even close allies such as neighboring Austria have rebuffed her approach, taking unilateral steps to stop migrants and usurping her assumed leadership on the refugee crisis.

The outcome has been a chaotic handling of the crisis, as well as a mounting humanitarian emergency of stranded migrants that aid groups say could worsen under the deal Merkel is trying to broker. The situation amounts to a disturbing twist of fate for the former physicist who, over the course of a decade, has brought modern Germany to the zenith of its post-World War II power.

“I do believe that Germany’s leadership potential has suffered as a result of the refugee crisis,” said Josef Janning, the head of the Berlin office of the European Council on Foreign Relations. “The other players have the impression that Germany doesn’t have a strategy and that Merkel is acting impulsively.”

[When Britain votes on the E.U., Western security could be on the line]

A preliminary deal reached last week with Turkey — but with few details worked out — was hailed as a game-changer after a year in which more than 1 million asylum seekers landed on European shores. But late Thursday, Merkel and other European Union leaders were still trying to agree among themselves on what, exactly, to offer before crunchtime talks with Turkey on Friday.

The possible deal with Ankara was sowing discord on multiple fronts. On Thursday, European Council President Donald Tusk acknowledged the formidable odds, saying he was “cautiously optimistic, but frankly more cautious than optimistic.”

View Graphic Journey alongside refugees through Lesbos, the gateway to a new life

An agreement would see Turkey willingly take back virtually all migrants trying to cross the Aegean into Greece — the entry point into Europe for migrants setting off from Turkey. Theoretically, migrants who make it could still obtain flash asylum hearings on the Greek islands. But the terms of the deal assume that Turkey, a nation used as a way station for migrants from the Middle East and beyond, would be declared a “safe country.” Therefore, anyone in need of international protection — including Syrians fleeing war — still could be sent back to Turkey.

The deal is also contingent on one big promise that Europeans may not be able to keep: that for every Syrian sent back to Turkey, Europe would fly in and resettle another Syrian directly from a refugee camp in Turkey. A draft deal circulating late Thursday in Brussels indicated that initially only 72,000 slots would be ­promised — equal to roughly one month’s worth of arrivals last year. In addition, the program would be voluntary, so E.U. nations would be free to say no thank you.

Human rights groups have blasted the deal, saying that it violates international law and that Turkey is by no means truly a “ safe country” for refugees. They cite alleged ill treatment of migrants, even the alleged forced repatriation of Syrians by Turkish officials.

“This trade-off between the E.U. and Turkey is inhumane and illegal,” said Selmin Calıskan, general secretary of Amnesty International in Germany.

[They’ve escaped war and crossed the sea. Now Europe wants to send them back.]

In return for keeping migrants on its territory, Turkey would get as much as 6 billion euros, about $6.8 billion. But Ankara is seeking other concessions. They include visa-free travel in Europe for Turks — long opposed by France and others. Turkey also wants to jump-start talks to join the E.U., a notion that has sparked horror and vows to block the deal by Cyprus, an E.U. member and former target of a Turkish invasion.

Previous German-led attempts to create for migrants a “legal route” into Europe have failed, as other member states have refused to live up to their part of the bargain. Hungary, one of the nations refusing to take any migrants, again insisted Thursday that it would not change its policy.

In fairness, analysts say, Merkel is pushing for a “bad deal” in part because other nations in Europe have abandoned migrants, leaving Germany as the last nation willing to offer large-scale shelter. It cannot do so indefinitely, and Merkel knows it. As anti-migrant sentiment grows, she is searching for a way to live up to a promise to her people that migrant inflows will be dramatically reduced.

That Merkel is seeking such a deal fits with her image as a pragmatist — if not with her image as a humanitarian.

“I’ve always found that this Mother Teresa image of Merkel is wrong,” said Thomas Jäger, a political analyst at the University of Cologne. “Her policy is about keeping Europe united and economically competitive.”

Griff Witte in London and Stephanie Kirchner in Berlin contributed to this report.

Read more:

As the route to Europe closes, migrants journey through grief

Migrants seek landfall in Europe even as deal takes shape to send them back

Today’s coverage from Post correspondents around the world