Roky Erickson starring at this week's Noise Pop Festival is not just another surprising comeback for a deserving rocker, but almost a victory over evil. Erickson returns to San Francisco 40 years after he first arrived in town, and he finally is pieced back together -- a whole man, free from demons that have plagued him most of his adult life.

At a Great American Music Hall performance on Thursday that was sold out long in advance, the Texas rock recluse, for years little more than a rumor, faces an ecstatic crowd. It is his first Bay Area performance in more than 25 years.

The new documentary film that chronicles his emergence from a living nightmare, "You're Gonna Miss Me," plays a special Noise Pop screening the night before. He is not only the poster boy for the 15th annual weeklong event, but one of the hottest tickets to any of the dozens of shows spread across town at various nightclubs, mostly featuring groups half his age.

Backed by the same three-man band, the Explosives, that played with him in the '70s and '80s, Erickson, 59, tears through a power-packed set, singing and playing guitar with complete command. It is an impressive performance from a guy who is usually mentioned in the company of other rock casualties like Syd Barrett of Pink Floyd or Brian Wilson of the Beach Boys.

As the film spells out so plainly, Erickson's life deteriorated rapidly after he was arrested in Texas in 1969 for possession of a small amount of marijuana and pleaded insanity rather than face a stiff jail sentence. He was incarcerated for years in an institution for the criminally insane, jailed alongside murderers, rapists and other violent criminals, subjected to electroshock treatments, carpet-bombed with tranquilizers.

When he was released in 1973, Erickson's head was ablaze with beasts, ghouls and monsters from B-movies, which he spilled out in raw, urgent rock songs such as "I Walked With a Zombie," "The Creature With the Atom Brain" and "Two Headed Dog." Inside his mind, he was living a horror movie.

When director Kevin McAlester began filming in 1999, Erickson was blasting himself with white noise from stereos and television, stockpiling junk mail and making scrupulous lists of the catalogs and advertisements he received. He was watched over by a mother who spelled out her life story on giant cardboard storyboards and strange home movies. He had stayed out of contact with the outside world for years and years.

He kept a legal-looking document with a gold seal in a frame on his wall that attested to the fact that he was actually an alien, in hope that it would convince whoever was jolting his head with electric shocks to stop.

After his Music Hall show Thursday, fans holding posters, old photographs and scraps of paper wait in a line that stretches across the nightclub floor, as Roky sits behind a card table and carefully inscribes everything he is given, shakes every hand, greets every fan. Standing over his shoulder, his 44-year-old brother, Sumner, beams behind Buddy Holly black horn rims. It was Sumner who rescued his older brother from the depths of insanity and wrested away legal control of his brother's life from their mother.

Erickson had been the lead vocalist of the 13th Floor Elevators, the first Texas psychedelic rock band, and when the group's first single, the garage rock classic "You're Gonna Miss Me," turned into a smash hit on San Francisco radio, the Elevators came out to play early shows at the Fillmore and Avalon Ballrooms in fall 1966, just as the San Francisco rock scene was starting to bloom.

In the audience at the Music Hall is 13th Floor Elevators founder Tommy Hall, who has lived for years in a Tenderloin hotel. They pose together for a quick photo on the club's dance floor after the show. They haven't seen each other since Erickson got out of the mental hospital. The reunion is brief. Erickson goes on to sign autographs, and Hall drifts off.

The evening before, Erickson and his brother attend a jam-packed Noise Pop Film Festival screening of "You're Gonna Miss Me" at the Roxie Cinema. They have lunch in Chinatown with another '60s rock relic from Texas, Powell St. John, who lives in Berkeley these days. St. John and Clementina Hall, lyricist for the 13th Floor Elevators who also now lives in the area, take their places in the row in front of Erickson and his brother. Sitting in his seat after the screening, Erickson flashes a big smile, happily signs autographs and poses for photos as dozens of people swarm over him, holding out dog-eared LP jackets for him to sign. He looks every one in the eye and smiles broadly.

"It was fun," Erickson says, walking down the sidewalk outside the theater.

His brother doesn't necessarily agree. "My feet are still shaking," he says.

"You're Gonna Miss Me," the documentary, is an unflinching look at the depths of their family's depravity. Their nutty mother takes center stage. Their taciturn father makes only a brief, chilling appearance. The extensive family home movie footage throws up one startling, vivid image after another; young Sumner bailing out the muck on the bottom of the empty swimming pool, or Roky dressed in robes and crown in a bizarre quasi-religious fairy tale his mother made after he returned from the mental hospital, in which he is crowned "King of All Beasts." The swimming pool footage still clearly makes Sumner uncomfortable.

But not Roky. He loves the movie and enjoys watching it at the Roxie, the fifth time he's seen it since its premiere at the 2005 South by Southwest festival in Austin, Texas. He has no favorite scenes. "I like it all," he says, smiling.

The movie is framed by the court battle for Roky and ends with Sumner named guardian over their mother, and the judge admonishing everybody to live up to their responsibilities -- which, in the deranged world of "You're Gonna Miss Me," is what passes for a feel-good epiphany. The movie leaves Roky living with his brother in Pittsburgh, Pa., taking the first few, tentative steps to a new life. But that turned out to be just the beginning.

Last week, four years later, the same Texas court ended the conservancy. Their mother, who had resisted all previous efforts to help Roky, testified on behalf of her son. "She's awesome," says Sumner.

Roky Erickson has come back from the land of the living dead, from walking with zombies. He lives in his own apartment. He has his old band back behind him and is making more performances (plans call for the Coachella Festival and summer European dates). He will hold his fifth annual Ice Cream Social at South by Southwest later this month (ice cream is a special favorite with Erickson -- at Amy's in Austin, they named the vanilla and sweet cream milk shake after him). The band and Erickson only started playing together again at the Ice Cream Social two years ago. He has a driver's license for the first time since the '80s and owns a Volvo. He quit smoking. He weaned himself off psychiatric drugs; he took his last pill Christmas Day.

"All the time I was in his band, Roky could never remember my name," says guitarist Cam King of the Explosives. "He walks up to me a couple of years ago at an Austin park music festival, holds out his hand and says, 'Hello, Cam.' "

At the heart of this story of redemption is a younger brother, 15 years his legendary brother's junior, who remembers his older brother bringing home an identical pair of pants, only smaller, for his baby brother. "I thought I was in the band," Sumner says.

He also remembers visiting his older brother under Dickensian circumstances at the Rusk State Hospital when Sumner was in elementary school. Sumner's "crusade" to salvage his older brother gives the documentary its narrative engine. Sumner had been the only one of the five boys to get out and was working as the principal tuba player in the Pittsburg Symphony. But the movie stops in 2002.

Since then, Roky has spent a year going to therapy three times a week. His brother tapped out his credit cards to pay the bills. They both moved back to Austin. Roky was fitted with a set of false teeth -- the abscesses in his mouth are mentioned in the movie -- which has left him constantly shifting his jaw around, sucking on his teeth.

Earlier in the evening, Roky sits for an interview in his hotel lobby. He arrives immaculately attired in Native American tapestry jacket and a polyester shirt with pictures of Elvis. He is cordial, upbeat, unfailingly polite and generally answers every question with one of three replies: "Yeah," "All right" or "Thank you." He is not a man to mince words.

Asked what he remembers about San Francisco from when he played several months at the Fillmore and Avalon in 1966, he thinks for a moment. "Lots of hippies," he says.

He says he is thinking about writing new songs. "Love songs and rockers," he says.

He says plans for a movie about his life starring Jack Black fell apart. "He bowed out -- he said he couldn't fill my shoes."

He makes eye contact and grins broadly. He talks happily about the end of the conservancy and the pharmaceutical regimen. But not more than a couple of words on anything. He listens alertly and is thoroughly engaged in the interview.