Brian Banks logged onto Facebook last year, and a new friend request startled him.

It was the woman who, nearly a decade ago, accused him of rape when they were both students at Long Beach Poly High School.

Banks had served five years in prison for the alleged rape, and now he was unemployed and weary. So he replied to Wanetta Gibson with a question: Would she meet with him and a private investigator? She agreed.

At the meeting, which was secretly recorded, Gibson said she had lied. “No,” she was quoted as saying, “he did not rape me.”

That admission set off an extraordinary chain of events that culminated Thursday morning. A Los Angeles County Superior Court judge dismissed Banks’ conviction, ending 10 years of turmoil in a hearing that lasted less than a minute.

Banks, 26, bowed his head and trembled, his eyes flooding with tears. His girlfriend, Pamela Soladar, yelped with joy. They made their way to each other and embraced; Banks was too overwhelmed to speak.

“You made it,” she whispered to him.

It had been a long, maddening journey.

In the summer of 2002, Banks was considered a top college football prospect. A 6-foot-4, 225-pound middle linebacker at Long Beach Poly High, Banks said he had been courted by USC, UCLA and other football powerhouses.

He was attending summer school, and asked his teacher for permission to leave class so he could make a phone call, according to court papers. Then Banks, a senior, ran into Gibson, a sophomore.

Banks said they fooled around, but that their sexual contact was consensual. His mother, Leomia Myers, believed him, and said she sold her condo and her car to pay for his defense.

“I knew I didn’t raise my son to do something so horrendous,” she said.

Gibson’s version shifted over the years. She could not be reached Thursday for comment.

Initially, court papers show, she told a classmate in a note rife with misspellings: “he picked me up and put me in the elevator and he took me down stairs and he pulled my pants down and he rapped me and he didn’t have an condom on and I was a virgin now Im not.” Gibson later told authorities a similar, more detailed story.

But when she testified during Banks’ preliminary hearing, Gibson faced the rigorous questioning typical in sexual assault cases. She changed some details and added others, Banks’ attorneys alleged in court documents.

Banks had a choice: He could take the he said-she said case to trial and, if convicted, risk being sentenced to 41 years to life in prison. Or, as his lawyer advised, he could accept a plea deal.

Banks pleaded no contest to one count of forcible rape, spent five years in prison and, upon his release, was forced to register as a sex offender and wear an electronic monitoring bracelet. At one point, he begged the California Innocence Project in San Diego for help, but he was told that without new evidence, there was nothing its attorneys could do.

“It’s been a struggle, it’s been a nightmare,” he said. “It’s more than I can describe, the things that I’ve been through.”

Meanwhile Gibson and her family sued the Long Beach schools. They settled the case for $1.5 million. Gibson’s mother, Wanda Rhodes, could not be reached Thursday for comment.

Had Gibson not contacted Banks via Facebook, it’s unlikely their paths would have crossed again. But she felt guilty that he had lost out on going to college and playing football and had “a desire to make amends,” Banks’ attorneys said in court documents.

When Banks heard from her, he recalled, “I stopped what I was doing and got down on my knees and prayed to God to help me play my cards right.”

According to Banks and his private investigator, Gibson refused to tell prosecutors that she had lied, so that she wouldn’t have to return the money she and her family had won in court.

She also said she feared it would affect her relationship with her children, Banks’ attorney alleged in court papers.

But her taped admission was enough to interest the Innocence Project attorneys, who said they had never before taken the case of someone already released from prison. When they reexamined Banks’ case, said Innocence Project attorney Justin Brooks, investigators also found other evidence to back up his claims.

After the alleged rape, no male DNA had been detected on Gibson’s underwear, his attorneys said. Also, the classmate Gibson first told about the alleged attack — via the note — said Gibson later admitted to making up the story so her mother wouldn’t find out she was sexually active, attorneys said.

More recently, Gibson has backed off her recantation, Brooks said. Nevertheless, when presented with the Innocence Project’s findings, Los Angeles County prosecutors agreed that the case should be thrown out.

“It’s not our job to maintain a conviction at any cost,” Deputy Dist. Atty. Brentford Ferreira said. “It’s our job to do justice.”

He said prosecutors had no plans to charge Gibson, saying it would be a difficult case to prove.

Banks walked out of Thursday’s hearing as if in a daze. Someone handed him a black hooded sweat shirt with the word “innocent” in bold white letters.

He led a parade of supporters and cameramen outside the Long Beach courthouse, where he shared his hopes for restarting his football career. At one point, he grabbed his attorney’s hand and raised both their arms into the air, the pose of an athlete who has just clinched victory.

ashley.powers@latimes.com