TUTZING, Germany — A bronze statue of St. Joseph, bending protectively over the Holy Family, stands at the center of a bubbling fountain outside the St. Joseph Roman Catholic church in this Bavarian village.

Across a cobblestone courtyard, parishioners show up regularly at the church community center to teach German and math to asylum seekers and refugees. During a recent weeknight service, Ali, a young Afghan, demonstrated his progress, reading aloud a prayer for peace to the congregation.

This tranquil place is also the backdrop for a bitter debate between Germany’s government and its Roman Catholic and Protestant churches over the fates of hundreds of migrants seeking asylum here.

Just before Christmas, Ali and another young Muslim moved into the two-room guest apartment on the parish grounds, invoking a Christian practice of seeking protection within a church, a form of asylum known in German as Kirchenasyl, to stave off their imminent deportations.

The practice, while largely limited to Germany these days, speaks to wider questions about how officials across the European Union are handling the wave of humanity struggling to reach its borders, and the challenge of housing, employing, legalizing, and integrating the newcomers — often in the face of resistance from nationalists.

In April, about 426 migrants were living in parishes across Germany — more than three times as many as last year — according to Asylum in the Church, an ecumenical organization that helps parishes with legal and logistical questions. The practice began in Berlin in the 1980s, inspired by the Sanctuary Movement in the United States, in which churches sheltered immigrants from El Salvador and Guatemala.

While the rise of anti-immigrant demonstrations and recent arson attacks of refugee shelters reflect some Germans’ resistance to the arrival of more than 200,000 asylum-seekers last year, the tradition of church asylum represents another side of Germany.

The movement has infused Germany’s Roman Catholic and Protestant churches with a newfound sense of social purpose, after years of losing members because of sex abuse scandals and growing secularism.

But the government, which has repeatedly called for Germans to welcome the refugees, considers the practice illegal and sees the recent explosion of church asylum cases as a rebuke to European policy.

“It cannot be that church asylum is being used to criticize a difficult political situation,” said Katrin Hirseland, a spokeswoman for Germany’s federal office for migration and refugees.

Stephan Theo Reichel, a retired international businessman who counsels Lutheran parishes in Bavaria trying to take in asylum-seekers, said nonreligious Germans, mindful of the country’s Nazi past, had supported church asylum cases out of a sense of political responsibility.

“Given our history, we should be honored to help these people,” Reichel said. “We should be proud that they come to us and should do more for them.”

The cases of Ali and Abdullah Zadran, the Afghan migrant who joined him in the St. Joseph apartment, are typical. The pair have been threatened with deportation to the country where they entered the European Union. They are so-called Dublin cases, named after the recently recast Dublin Regulation, which specifies responsibility for asylum claims across the 28-nation bloc.

Ali, who gave only his first name because he says he is a minor, and Zadran both entered through Bulgaria last year. Neither wants to go back there.

Zadran said he had spent two months in a Bulgarian jail, a common destination for migrants arriving without authorization in that country, then fled to Serbia. After 10 days in a Serbian prison, he was released, and he hid in a truck headed north, he said.

“Here, life good,” Zadran, 21, said in a recent interview.

The asylum seekers’ plight has put them squarely in the middle of growing tensions over Europe’s handling of the many migrants fleeing conflicts and chaos in places like Afghanistan, Eritrea, Syria, Iraq, and western Africa. Last year, 570,800 claims for asylum were registered in the European Union, more than a third of them in Germany, according to the U.N. High Commissioner for Refugees.

Whether migrants travel on foot, as Ali and Zadran did, or in boats crossing the Mediterranean from Africa, many arrive in the countries on Europe’s southern and eastern rims, only to find insufficient support and legal systems to process their applications for asylum. From there, they press north and west, into Europe’s wealthier nations, such as Germany, Denmark, or Sweden.

But EU regulations require anyone applying for asylum to submit their application in the first country they entered. While Europe has adopted a common legal system for refugees, standards for housing and public benefits vary widely. Aid workers say complaints about overcrowding and new arrivals being beaten, jailed, or left to fend for themselves are common in some countries, including Bulgaria, Hungary, and Italy.

The German authorities are committed to the European policy. But asylum seekers who manage to remain in Germany for six months become eligible to apply for permanent asylum there, regardless of how they entered the European Union — which is why more migrants are confining themselves to church grounds, hoping to safely wait out that time period.

Ali said he fled Afghanistan on foot after the Taliban murdered his father. In Bulgaria, he spent nearly a month in jail, he said. When he arrived here, his one wish was for a tube of gel to style his hair. He claims that he is only 17, but German authorities who interviewed Ali estimated that he was older than 21.

German law prevents deportation of unaccompanied minors, even to another European country. But the legal process to establish Ali’s age could take months, and he was ordered to return to Bulgaria in December.

Only a third of those who applied for permanent asylum in Germany last year met the criteria. The others were ordered to leave or allowed to resubmit their applications.

The Rev. Dieter Müller, who runs the Jesuit Refugee Service for southern Germany, has helped settle dozens of asylum seekers in parishes across Bavaria. Like many in the church, he disputes the government’s contention that the practice is illegal.

“The purpose of a church asylum is to ensure a fair application to gain recognition as a refugee,” he said.

In February, Thomas de Maizière, Germany’s interior minister, came under fire when he compared Christians protecting asylum seekers with Muslims practicing a strict form of Islamic law.

De Maizière later retracted the statement and agreed to work with church leaders to evaluate extraordinary cases, before church asylum is considered necessary.

For Angelika Pfaffendorf, 65, a volunteer at St. Joseph who became a den mother for the two young Afghans, it is a simple matter of humanity.

In the months the young men spent in the church, she watched over their progress and made sure that Zadran got out of bed in the morning and left the apartment he shared with Ali.

After psychological treatment for trauma, Zadran began taking part in life around the parish, shoveling snow, helping to set up and clear away chairs for meetings, and taking daily lessons in German and basic math.

“He can’t go back to Bulgaria,” Pfaffendorf said. “He would wind up on the street and slip into a life of petty crime.”

After more than two months on the parish grounds, Zadran was granted the right to apply for permanent asylum in Germany. Ali was still waiting.