Trinity Memorial Church at 22d and Spruce Streets was failing in the summer of 1994, and the few dozen remaining congregants knew it.

They talked about selling off the oak pews, or even the chocolate-brown Victorian building itself, but the conversation kept going in circles. The members of the little Episcopal church just couldn't agree what to do.

Then, in the midst of their collective soul-searching, the historic church and its congregation were saved, oddly enough, by a bolt of lightning.

The colossal strike was part of the assault from a ferocious summer storm that ravaged Philadelphia late on the evening of July 27. The fire bolt hit the chimney first, then traveled along the main wooden beam in the peaked roof. A spark smoldered undetected for hours before bursting into flames so immense they cast a curtain of light over the entire Fitler Square neighborhood. By morning, the roof was a charred black skeleton and fragments from the elaborate stained-glass windows carpeted the church floor.

Instead of seeing the fire as a sign to call it quits, the congregation vowed to reinvent its 1874 building as something more than just another church where people go to sit on hard benches once a week.

On Sunday, Trinity celebrated the 20th anniversary of its transformation into a bustling community hub that operates in concert with a nonprofit called the Trinity Center for Urban Life. Rebuilt with a more flexible interior, better acoustics, and modern lighting, it is now home to a diverse collection of arts groups, a prestigious preschool, and a homeless shelter, as well as a small, but stable, religious congregation.

"There isn't a time when this building is not being used for something," the Rev. Donna Maree said after celebrating a special thanksgiving service heavy on Scripture featuring imagery of fire and regeneration.

In a city where about 800 historic churches and synagogues are struggling to keep their doors open, Trinity's comeback strategy is increasingly seen as a model. "What they've done is very special," said Robert Jaeger, president of Partners for Sacred Places, a Philadelphia group that counsels religious congregations around the country.

Instead of bemoaning the dwindling number of practicing Episcopalians in the neighborhood, he said, Trinity succeeded because it used the reconstruction effort to reach out to a wider community. Creating the nonprofit was key, enabling the church to receive grants and tax-deductible donations.

Before the fire, Trinity was a typical Victorian church building, dark and uninviting, said Kaki Kriebel, a longtime member. The front doors were heavy slabs of carved oak painted red. "You had to be really determined to go inside," she recalled.

Members knew refashioning the church into a neighborhood center required a friendlier architectural welcome. But because the building is a historic structure designed by Henry Augustus Sims, they were also obligated to rebuild the damaged church according to exacting preservation standards.

The solution was to find ways to inject a modern sensibility into the Victorian building, said church members John Kohlhas and John Randolph, architects who advised the congregation.

Members who had been so reluctant to give up their pews before readily agreed to replace them with movable chairs and a fold-up altar so the nave could become a multipurpose performance space. Unlike so many older churches, Trinity is a perfect canvas for events because it has no side aisles or columns.

The other goal was to brighten the interior. After the broken stained-glass fragments were gathered up and reassembled, the windows were cleaned to allow in more abundant natural light. Discreet modern lights were added behind the dark wood of the buttresses.

The break came when the church discovered its heavy front doors were originally pocket doors. That meant they could be pushed off to the side and modern glass doors could be installed at the main entrance. Now when visitors arrive, they can see straight into the nave through a glass vestibule.

Trinity is now just as likely to host an Egyptian jazz band sponsored by Al-Bustan Seeds of Culture as a traditional baroque chamber ensemble. The parish house has become the go-to meeting spot for scouts, the Philadelphia Boys Choir, a local writers group, members of a nearby community garden, and Alcoholics Anonymous. You can set your watch by the drop-off of preschoolers at day care in the mornings and the arrival of men at the homeless shelter in the evenings.

"God really knew what he was doing with that lightning," church member Joanne Tanfield told the congregation during Sunday's celebration.