A vein in Alan Segal’s brain had “sprung a leak,” but no amount of blood loss could dull his wit. Even on the operating table.

“Doc,” he asked the surgeon staring down at him in Jefferson University Hospital. “Will I be able to play the violin after this?"

When the doctor assured Segal he would, he quickly shot back, before the anesthesia took hold.

“Great! Never took a lesson in my life."

The 77-year-old laughed recently, 13 years later, as he recalled the story in his apartment overlooking the Benjamin Franklin Parkway. But his recovery after the surgery that corrected the arteriovenous malformation in his brain — essentially a bloated knot in the blood vessels — was anything but funny.

“You name it, I couldn’t do it,” said Segal, a long-retired certified public accountant. "Couldn’t walk, couldn’t read, couldn’t write, had zero hand-eye coordination. And the whole time, I was fully awake and aware.

“It was the single most frustrating experience of my life,” he said.

Segal bludgeoned his way back to the life he wanted through sheer force of will, wielding his upright bass the entire way.

In 2011, he officially created the Jazz Sanctuary, a rotating quintet of musicians that plays at events for nonprofits and houses of worship in the city and its suburbs. The group plays for free, often to the bewilderment of first-time “clients.” And on April 25, the group rounded out its 500th performance.

“This world is so divided today, there are so many disparities between groups,” Segal said. “But not when those people show up to hear music. For two hours, they’re a single, solid entity. In music, there’s a sense of belonging."

The program was born, he said, out of gratitude.

During Segal’s recovery from surgery, it took him two years of practice with the bass to get back to his old abilities. Two years to find the correct strings without looking at his instrument. Two years before his eyes could glide across a page of music without seizing up halfway.

The process woke up something inside him, and it wouldn’t let him rest on his accomplishments in recovery, great as they were.

“Suppose you couldn’t do anything, and people came in and sat with you, called you on the phone, reached out and gave of themselves to help you,” Segal said. "What do you do when you get better? You say, ‘The hell with them, I’m going back to work?’

“Well, you could; most people do,” he added. “But I thought it was time to give back, time to give someone something of myself.”

His Jazz Sanctuary project caught the attention of his former physical therapists at Magee Rehabilitation, who made him the cover story of Can Do magazine, the hospital’s semiannual publication.

That particular issue was read with great interest by M.J. Schmidt, the chair of the Paoli-based Council on Brain Injuries. She sought Segal out almost immediately.

Together, the two organized performances for the patients working with the council, as well as “bucket drumming” classes that help them hone their fine motor skills.

“He’s the real deal, he’s just so generous in his spirit and in his wanting to partner with us, and we just think the stuff that the [Jazz] Sanctuary does really adds to their lives,” Schmidt said.

Part of that success, she believes, is the camaraderie that Segal has with the council’s patients, given his own journey through recovery.

“People who don’t have such tragedies in their lives don’t understand this,” she said. "These single little events, for some people, might be the thing they’ve looked forward to for a month or two, a chance to talk to other people who are like themselves.

“It makes a difference, he’s making a difference, and we just love him,” she added.

She’s not alone. Segal has left behind a trail of high praise from congregations and charities across the region, from South Philly to Doylestown.

In January, the Lower Gwynedd-based Wissahickon Faith Community presented Segal with its Martin Luther King Jr. Memorial Community Award, a gesture that Segal said floored him.

“It’s enough that when you go in and do the event, that people appreciate the music,” he said. “That’s enough; that’s more than enough. But to get something like this? That’s truly special to me.”

But for the Rev. Charles W. Quann, the award’s program coordinator, the choice was obvious. Segal has been playing at Bethlehem Baptist Church in Spring House, where Quann is pastor, for three years, and routinely offers scholarships for children to learn how to play music.

“He’s a wonderful human being, always concerned with those who are disenfranchised and disadvantaged, and he always offers to make himself available,” Quann said. “And I’m so appreciative of all that.”

Segal’s current goal, the principle that helps drive his efforts, is finding a way to keep the Jazz Sanctuary alive beyond his own life span. It’s an objective that comes naturally to a man who fought for a second chance at life.

“I want to leave behind something that will continue and carry my name in a very positive sense,” Segal said. “I want people to recognize the importance of the things we produce.”