Somali refugee Said Musa Mudhallib, 31, stands outside the Saint Familia church in Kassel, Germany. (Adam Berry/For the Washington Post)

Somali asylum seeker Ismail Mohamed Hassan, 22, awoke one nippy morning to an early knock at his refugee center door. It was the state police bearing two unpleasant gifts — a one-way ticket out of Germany and a car ride to Frankfurt Airport. This was it, he recalls thinking. Deportation.

Unless he could find a way to stop it.

Germany is ground zero in Europe’s migrant crisis, a nation set to receive up to 1 million asylum seekers this year, far more than any other country in the region. Yet, like Hassan, after risking their lives by land and sea to reach the continent’s economic powerhouse, about one in every two asylum seekers is initially rejected. It has made asylum a numbers game. In Germany, 86 percent of Syrians are being granted some form of refugee status, as are 82 percent of Iraqis and 80 percent of Eritreans. Only 30 percent of Afghans are making the cut. For those coming from Kosovo and Albania, the acceptance rate stands at almost zero.

But if Hassan’s story suggests the trials set to face hundreds of thousands of rejected asylum seekers — two stressful years spent in a bureaucratic nightmare trying to stay — it also offers them a ray of hope. While vast numbers of migrants like him are being rejected, far fewer are actually being deported.

First instance asylum decisions

Saying its generous system has become an incentive for more and more migrants to rush into Europe or die trying, Germany is preparing a new crackdown on those it says should leave. That has thrust this nation of 81 million to the center of the debate over perhaps the biggest question of the crisis: Of the hundreds of thousands of migrants coming, who gets to stay?

Even in the United States, deportation cases of undocumented migrants can linger for years. But because the migrants coming to Europe in dramatic waves are largely applying for legal asylum, they are benefiting from a catalogue of appeals and pseudo-statuses including a precarious right to remain that is simply called “toleration.” If they can stall long enough, German codes potentially allow them to beat the system and win permanent residency. And even when deportation orders come through, there are ingenious ways around them.

Hassan was one of the unlucky ones. A lithe construction worker with scars on his body he says came from a 2011 al-Shabab bomb blast in Mogadishu, he is one of the untold thousands being rejected without even a review of his case. That’s because, like most of the hopeful refugees arriving here, he first entered Europe in a different country. In his case, it was Bulgaria, a no man’s land for migrants where he was slapped in jail. Under E.U. law, Germany does not have to listen to his claim. It can just send him back.

It tried to do just that on the cold December morning last year when police hauled him to Frankfurt Airport.

But once aboard a flight, Hassan managed to block his deportation. German policies restrict the use of force during expulsions, and some deportees have taken to kicking and screaming inside plane cabins to thwart take-off. Hassan said he merely informed the crew that he was leaving involuntarily. The result: Citing a possible safety risk, the pilot allowed him to disembark. With no grounds to detain Hassan further under German law, frustrated authorities released him.

Back in Kassel, his lawyer found him a shield against another deportation attempt: Church asylum. Hassan packed up and moved into a welcoming Catholic church. There are no laws offering legal sanctuary in churches. But such protection is a German tradition dating to the Middle Ages, and officials here have been loath to challenge it. For Hassan, it might be a solid plan. If he can avoid deportation for four more months, a loophole in the asylum law would compel the German government to hear the merits of his case. Because the Germans — citing logistical and safety issues — are generally not deporting Somalis to their home country, he has a good chance of being allowed to stay.

“I cannot go back to Somalia,” Hassan said inside the tranquil rectory of St. Familia Catholic Church, a sanctuary he rarely leaves for fear of being arrested. “It is too dangerous there. I won’t go back.”

New laws being considered

In the German city of Osnabrück, local activists have started blocking deportations by forming human chains outside the houses of refugees. In a decentralized system that gives states the power to rule on deportations, the national government is also grappling with liberal German governors who at times have effectively declared moratoriums on deportations.

Yet as the tolerant Germans become overwhelmed by the sheer number of arriving migrants — and as concern grows that their accepting system may be serving as a magnet — the government is starting to roll up the welcome mat.

A new draft law to be debated in the German Parliament would, for instance, take aim at the majority of migrants who, like Hassan, are traveling to Germany through transit countries such as Hungary, Bulgaria and Croatia. Part of the plan is to disincentivize staying. Rather than offering cash benefits and housing to those being ordered to leave — Hassan, for instance, received aid for 24 months as he fought deportation — such migrants would instead simply receive some food and a one-way ticket out.

Germany last year managed to return only 4,700 of the 35,000 migrants who were told to go back to those nations — in part because deportations are difficult. Commercial and charter flights can be expensive. Also, many of the migrants coming now don’t have passports or travel papers, making expulsion a bureaucratic and logistical mess.

“Elections are not won by dragging families out of bed at 6­ o’clock in the morning,” said Kay Hailbronner of the research center on immigration and asylum law at the University of Konstanz.

The new law, however, would not close the important loophole being used here by Hassan and others to avoid deportation to transit countries. If an asylum seeker can manage to fend off deportation for six to 18 months, the German government has no choice but to reopen their case.

Inside the hallowed halls of Trinity Lutheran Church in southwest Berlin, the makeshift beds and sounds of Farsi and Amharic in the recreation hall hint at one of the most divisive tools being used to thwart deportations in Germany. Across the nation, 297 churches are currently granting asylum to 452 people facing immediate deportation.

Many churches — like St. Familia in Kassel where Hassan has lived in the rectory for the past eight months — are offering shelter to the mostly Muslim asylum seekers without spiritual strings attached. Others, like Trinity, are largely aiding only those who are or wish to become Christian. In recent years, the Rev. Gottfried Martens claims to have succeeded in converting hundreds of Muslim migrants.

Either way, churches are offering a golden opportunity to those attempting to crack the code of Europe’s asylum system. Nariman, a 25-year-old Iranian who has pitched a tent in Trinity Lutheran’s back yard and asked that his last name be withheld, said he tried for three years to win asylum in Norway based on his assertions that he was being harassed by Iranian secret police for being an ethnic Kurdish activist. Rejected and facing deportation to Iran, he scrambled to Germany three months ago.

But then German authorities wanted to deport him to Norway. So he asked for sanctuary at Trinity. Born Muslim, he said he was an atheist when he arrived in Germany this summer. But a friend in his refugee center, he said, convinced him that “Jesus is our savior.”

Becoming a convert may aid his claim of persecution in Iran. And if he can delay expulsion by several more months, Nariman can use the same legal loophole as Hassan. The German government will be compelled to reexamine his case if it can’t manage to deport him to Norway.

“If they send me back to Iran, I will be killed,” said the young man with intense eyes. “I have to stay here, and I think the Germans will let me. They are not as racist as the Norwegians.”

‘Somalia has problems, too’

At St. Familia in Kassel, the city where the Brothers Grimm crafted some of their most famous fables, Hassan and another Somali man fighting deportation — Said Musa Mudhallib — spend most of their days in the library of the rectory. Fearing arrest, they rarely leave the church grounds, and they take turns in the kitchen cooking fresh injera flatbread and Somali stews.

Neither man begrudges Syrians for having such a high initial acceptance rate. “But Europe needs to understand that Somalia has problems, too,” Muhdallib said.

Germany has already sent back thousands of rejected asylum claimants from Balkan countries. But for many rejected asylum seekers, a final ruling can, or often does, take years. If they can stretch out their cases for up to six years, a law here allows many to apply for permanent status — suggesting that Germany may be forced to absorb the majority of those seeking asylum.

The new law would also target economic migrants and so-called “benefit tourists.” Those denied asylum would find it harder to obtain lesser protections that grant them a temporary right to remain. Strong attempts would also be made to identify opportunists — such as a host of North Africans now pretending to be Syrians. Those rejected asylum seekers who fail to voluntarily leave the country could also be subject to forced removal without advance notice.

“Deportation is always difficult, but maybe you have to remove 100,000 to help the other 600,000 find a way to stay,” said Demetrios G. Papademetriou, president emeritus of the Migration Policy Institute, a Washington think tank. “Europe needs to develop a backbone, to say that on principle, if you are an unauthorized immigrant, an economic migrant, we are going to identify you and send you back.”

Stephanie Kirchner contributed to this report.

Read more:

The Arab world’s wealthiest nations are doing next to nothing for Syria’s refugees

As tragedies shock Europe, a bigger refugee crisis looms in the Middle East

Read The Post’s coverage on the global surge in migration

Today’s coverage from Post correspondents around the world