SAN DIEGO -- One of San Diego's more infamous sex criminals, due to be released from prison after serving 25 years behind bars, will instead stand trial to determine if he remains a "sexual predator" and should be kept at a state mental hospital.

That was the decision Thursday by San Diego County Superior Court Judge Louis Hanoian after a hearing involving convicted rapist Alvin Quarles, who had been set for release from prison.

Dist. Atty. Bonnie Dumanis and Los Angeles attorney Gloria Allred are attempting to keep Quarles from being released. Allred represents two of Quarles' victims, who attended the hearing and said later that they were relieved at the judge's decision.

The two victims told reporters that they plan to attend future court sessions because they want to keep Quarles from attacking other women.

“It’s been hard because it’s like a box of bad memories has been reopened,” said Mary Taylor, now 52.

Dubbed by police as the “Bolder Than Most Rapist,” Quarles, now 51, attacked his victims at knifepoint, sometimes forcing the women’s husbands or boyfriends to watch, and in some of his attacks, forcing the men to have sex with the women while he watched.

Quarles pleaded guilty in 1989 to a series of sexual assaults that had terrorized women throughout National City and the San Diego neighborhoods of Clairemont, Mission Valley and East San Diego.

Under a plea bargain with prosecutors, Quarles, then 26, pleaded guilty to four counts of rape, six of burglary and two of robbery and was sentenced to prison for 50 years.

If he had chosen to go to trial on all 61 counts, he could have been sentenced to more than 200 years. Police had linked Quarles to a dozen attacks.

Under the law in effect when he was sentenced, Quarles was eligible for parole after serving half of his sentence based on credit for "good time." In 1994, the law was changed to require a violent prisoner to serve at least 85% of his sentence.

In August, the prison system said that Quarles would be released before the end of the year. His release date was later set for Nov. 16.

Quarles has been behind bars at the prison in San Luis Obispo.

The district attorney’s office is attempting to keep him in custody under what is called a “civil commitment.” At Thursday's hearing, two psychologists testified that Quarles remains a threat to the public. Quarles did not attend Thursday's hearing.

Quarles raped women to act out fantasies that he had acquired after watching pornography, the judge was told.

A hearing was set for next month to determine a trial date.

ALSO:

Man accused of lighting mother on fire pleads not guilty

Family of Corvette driver shot dead by LAPD to file $20-million claim

Yum Yum Donuts robber who stabbed worker with screwdriver is sought

tony.perry@latimes.com

Twitter: @LATsandiego