Philadelphia has 839 historic sacred spaces — churches, temples, and mosques — or one for every 1,900 residents. That's a lot of big, beautiful buildings facing uncertain futures.

The Pew Charitable Trusts decided to inventory the city's current and former houses of worship, and released a report Wednesday on the lay of the laity's land, looking at the vulnerabilities these structures face — from physical deterioration to changing neighborhoods and shrinking attendance.

"You hear a lot of anecdotes but we didn't know how many were still standing, what condition they were in, how they were being used, and their impact on civic life," said Larry Eichel, director of the Philadelphia research initiative at Pew.

Despite dwindling religious participation, most of the city's sacred spaces — 83 percent — are still used for religious purposes. Nearly half are no longer used by the building's original congregation.

The changing uses of the buildings are markers for migration patterns. Take the beige structure on Limekiln Pike in West Oak Lane. It was founded in 1947 as Temple Sinai synagogue. After World War II, Jewish families moving into the neighborhood in high numbers gathered there for services and community events. By the 1970s, the neighborhood had become predominantly African American and the temple became a Christian church, the West Oak Lane Church of God .

In 2013, it became the Masjidullah mosque.

Sometimes there isn't a growing congregation to swoop in and save a building.

About 82 historic spaces — roughly 10 percent of the total — have been adapted for other uses — such as offices, child-care centers, and apartments.

Most repurposed churches are in the center of the city and in neighborhoods that are stable or undergoing revitalization.

The Brewerytown residents who live in the North Abbey Apartments rise and shine in a former Protestant Episcopal Church of the Covenant. Their homes feature original stained-glass teardrop windows and Gothic-style wood molding preserved from the 129-year-old church.

In East Falls, the Schuylkill Methodist Episcopal Church is now office space for architects, freelance writers, an illustrator, graphic designers, an artisan baker, therapy offices, and a photographer.

Sacred buildings can be difficult to renovate, the report notes, with complex layouts and aging facades, not to mention old-fashioned heating and electrical systems.

Researchers from PennPraxis looked at the exterior of every historic space and found 74 percent had problems with windows or doors. More than half had suffered damage to masonry, wood, or vinyl facades. Many needed new roofs. On the whole, though, looking at exteriors only, most of the buildings were in "good or very good shape."

Pew found that between 2011 and 2015, at least 23 historic sacred spaces were demolished, mostly by developers. About 5 percent were vacant in early 2016.

Neighborhood change leaves certain churches vulnerable. As long-term residents have moved away, "houses of worship seem out of sync with the changed neighborhood," the report said. Development can make parking difficult for dedicated congregants to return for services.

In Graduate Hospital, five predominantly African American congregations have left the neighborhood, Eichel said. New Light Beulah Baptist Church at 17th and Bainbridge was demolished in July to make way for five houses.

The report suggested churches are more resilient when they do what Shiloh Baptist Church in Graduate Hospital did: Throw out the welcome mat.

The church at 21st and Christian opens its space to a range of organizations and groups, including an acrobatics troupe, which uses the high-ceilinged sanctuary as a rehearsal space.

"They've made a real effort to throw open their doors to new and old residents of the community … sort of making the church a part of the broader community," Eichel said.

One thing most people making complicated decisions about a sacred building's future could use is more time, particularly in neighborhoods that are developing fast.

But nearly all of the sacred buildings — 79 percent — had no form of historical designation, which can often draw out the amount of time it takes for a demolition.