HAMBURG, Germany — There were cracks in the steeple, and the southeastern wall would somehow have to accommodate a niche pointing toward the holy city of Mecca, in Saudi Arabia, but those were not the biggest misgivings Daniel Abdin had about buying the Capernaum Church here in 2012.
More daunting than the millions of dollars in renovation costs was how residents of Horn, the working-class district where the church has stood since 1961, would react when they learned that Mr. Abdin and his thriving Muslim congregation planned to turn the derelict building into a mosque.
A church was “the last thing that we wanted,” said Mr. Abdin, 52, the director of the Islamic Center Al Nour in Hamburg, during a recent interview outside the former Lutheran church, a squat modernist structure of concrete and red brick that construction workers were slowly encasing in scaffolding.
But a church is what Mr. Abdin got, much to the dismay of some residents of this historically Protestant city in northern Germany, who view the building’s conversion into a mosque as a symbol of the so-called Islamization of the country.
“A breach in the dam” is how Helge Adolphsen, a retired pastor from another congregation, described Mr. Abdin’s church conversion plans in early 2013.
The local branch of the conservative Christian Democratic Union party called for the conversion to be halted. Another local pastor suggested that it would have been better simply to demolish the building, which was deconsecrated in 2002, rather than to let it become a mosque.
In 2013, a right-wing group obtained permission to hold a protest in front of the building. Organizers expected 100 participants, but only 16 people showed up. And, as has happened at other anti-Muslim demonstrations across Germany in recent years, they were far outnumbered by counterdemonstrators, who were estimated at 700.
The early cries of opposition to the conversion have since quieted, and the renovations are continuing. For now, some neighbors say, they are waiting to see how things turn out once the mosque opens.
Mr. Abdin said the early reactions were “total nonsense.”
“The church stood empty for 10 years, and no one cared,” he said. “But when Muslims bought it, suddenly it became a topic of interest.”
Mr. Abdin’s search for a new space for Al Nour, which is known as a progressive and diverse congregation, began in 2004. Since Al Nour’s founding in 1993, the congregants, now roughly 2,000 people from more than 30 countries, had been gathering in a converted underground parking garage in the central neighborhood of St. Georg. There, worshipers crowd under low ceilings and between concrete pillars for the five daily prayers, sometimes spilling onto the sidewalk out front.
“They pray between the cars,” Mr. Abdin said, shaking his head.
Rauf Ceylan, a professor of religious studies and sociology at the University of Osnabrück, said that Al Nour’s humble accommodations were typical of the so-called backyard mosques that Muslim immigrants have founded since they began arriving in large numbers in West Germany in the 1960s.
“Back then, Muslims wanted to return to their native countries, so they didn’t want to buy large buildings,” Professor Ceylan wrote in an email. “Today the situation is different. People want to stay in Germany, which is why they want to build proper mosques.”
Mr. Abdin shares this commitment to his adopted country.
“My heart beats Hanseatic,” the Lebanese native said in lightly accented German, referring to the region that includes Hamburg and where he arrived more than three decades ago. But “for me integration is not a one-way street,” he added, suggesting that the countries of Western Europe must acknowledge the needs of Muslims if they are to assimilate successfully.
There are now roughly four million Muslims in Germany, according to the country’s Religious Studies Media and Information Service, although by some estimates only half are practicing. That means that Muslims make up around 5 percent of the population of 81 million, compared with 49 million Christians, or 60 percent of the country.
The number of Christians in Germany has been shrinking since the 1990s, while those professing no religion have grown to over 27 million. On July 17, the assembly of Roman Catholic bishops in the country announced that almost 218,000 Germans had left their church in 2014 alone, the largest annual loss since at least 1990.
Protestant congregations in Germany have also had a sharp decline in attendance numbers, which was among the reasons the Capernaum Church held its final service in 2002, said Susanne Juhl, the last pastor of the congregation.
“It was very difficult for everyone who lives there, who saw their children baptized or confirmed there,” she said in a telephone interview. By the end, she recalled, only about 20 congregants were sitting in pews that had space for 500.
This legacy of decline contributed to Mr. Abdin’s ambivalence about moving into the church. “We wish that churches would become more full,” he said. “We don’t want to Islamize or take over churches.”
In the end, though, he had few other options. Lacking the resources to build a proper mosque, Mr. Abdin had sought to buy other buildings, but was prevented from doing so because of zoning restrictions. Because the Capernaum Church was already designated for religious purposes, no change-of-use permit was necessary. The congregation bought the building in late 2012.
Very few churches in Germany are transformed into mosques. This was the first that belonged to the Evangelical Church, the country’s largest denomination after the Catholic Church, with around 23 million members. While the German Evangelical Church, a federation of Protestant denominations, prohibits the direct sale of its buildings to non-Christian religious groups, Mr. Abdin bought the Capernaum Church from a third-party developer.
During the renovations, which are expected to conclude early next year, Mr. Abdin has tried to respect the building’s history. “The motto for me is: outside church, inside mosque,” he said. The facade will remain largely unchanged, yet the golden cross atop the steeple has been removed and replaced with Arabic lettering spelling Allah, or God.
Inside, the renovations are extensive. “You wouldn’t believe how much work this took,” Mr. Abdin said as he walked across a large empty hall, his footsteps reverberating off the bare concrete floor and vaulted ceiling.
“Everything has to be done from scratch,” he said, citing the large mezzanine that workers have built for female congregants and the tapestries bearing religious texts in Arabic that will hang from the walls.
But as the project has advanced, the controversy has largely subsided, thanks in part to a series of public discussions that Mr. Abdin hosted with the former pastor, Ms. Juhl, in 2014. After the initial outcry, many residents of Horn are reserving their judgment.
“It’s new for us, and for me, too,” said Christa Ludwig, 63, whose two children were confirmed in the Capernaum Church and who works in a senior center next to the building.
“They’re not wild about it,” she said, describing the residents’ opinion of the mosque. “But maybe when they go in and look at it, maybe they’ll feel differently.”
With the tensions somewhat eased, Mr. Abdin has a new problem on his hands. The Al Nour congregation has grown so much that the former church now cannot accommodate all of its members.
“I’m already looking for another piece of property where we can build a mosque,” he said, laughing. “Déjà vu. History repeating itself.”