Updated

PROVO, Utah -- A Utah judge on Thursday ordered a convicted sex offender freed from a state hospital after the man was deemed incompetent for trial, but not a danger to society.

Prosecutors wanted Lonnie Hyrum Johnson to stay at the Utah State Hospital for continued treatment so he could eventually face the nearly two dozen counts against him of rape, sodomy and aggravated sexual assault of a child, but did not object to the judge's ruling.

"The constitution prohibits me from holding someone who has not been convicted and who cannot participate in their own defense," 4th District Judge James R. Taylor said.

Johnson was eligible to be freed as early as Thursday afternoon -- privacy laws prevent hospital officials from commenting. Still, Johnson is not off the hook.

Taylor did not dismiss the case and ordered Johnson to meet with new psychiatric evaluators in October. A hearing on those findings is set for Nov. 17.

"We're encouraged that Judge Taylor allowed us to have a review in six months," said Deputy Utah County District Attorney Craig Johnson, who is not related to the accused. "We'll come back in the fall and see how he's doing and hopefully get this case back on track."

Lonnie Johnson's family, which packed the front row of the Provo courtroom on Thursday, has said he is innocent of the charges.

"I'm happy, I'm happy," Johnson's mother, Wanona Pixton, shouted as she left the court after the hearing,

Christy Danner, the mother of one of the two victims, was not.

"We're not happy, but we've just begun to fight," Danner said. "We're not gonna let this die. We're not gonna lay down. And we're not gonna go away, as much as him and his family would like that to happen. The truth will come out."

The case has drawn national media attention, and Craig Johnson has spoken out widely about the need to alter Utah's civil commitment laws. The resulting publicity drew about 100 voicemail messages from individuals in 20 different states, including some that court security officers considered harassing, court spokeswoman Nancy Volmer said.

Johnson has a cognitive disorder, prosecutors said. He was charged in 2007 with 21 sexual assault charges. Authorities allege he had inappropriate contact with his stepdaughter and her cousin over five years beginning in 2001. Both alleged victims are now adults.

Taylor deemed Johnson incompetent for trial in 2008. Under Utah law, a defendant fits that condition if he suffers from mental illness, cannot understand the charges against him or is unable to participate in his own defense. For a civil commitment, a doctor must find that a person's mental illness makes him a danger to himself or others.

The court ordered doctors to attempt to restore Johnson's competency but about a month ago they said they had seen no improvement despite 2 1/2 years of treatment.

Taylor then said he believed it was unlikely Johnson would ever be able to stand trial. A civil commitment petition, which would have kept Johnson hospitalized, was also denied last week after three psychiatric evaluators said they did not believe he presented a danger to himself or the community.

That judge said he didn't believe state civil commitment laws were broad enough to allow him to consider Johnson's pending criminal case and that the circumstances of a 2006 rape conviction out of Washington state were not substantive enough to outweigh the opinions of medical experts.

Johnson pleaded guilty in 2006 to the rape of a teenage girl in Washington state and was sent to prison but served less than a year before being released. He is now required to register as a sex offender.

On Thursday, defense attorney Tom Means said he agrees with doctors who determined Johnson was incompetent. Means described his client as "bewildered" by court proceedings and unable to participate in his own defense. Means agreed with the judge's decision to reevaluate Johnson in six months.

"I think he's done exactly the right thing," Means said.

Johnson's sister, Cindy Lorenz, denies the allegations against her brother and said they stem from a bitter divorce battle between Johnson and his wife.

In an email to The Associated Press, Lorenz also said she believes her brother's civil and medical privacy rights had been violated. Lorenz also provided the AP with a copy of a letter sent to the Utah governor's office in which she asks for a meeting to show Gov. Gary Herbert proof that her brother has been wrongfully accused.

"This is scary and, yes, with what is going on, the manipulation of the justice system, this could happen to you, or somebody you care about, before you realize how horrible it is," Lorenz wrote.

No meeting had been scheduled as of Thursday. In an email to the AP, Herbert spokeswoman Ally Isom said that for now the governor believes the court was the appropriate setting for addressing the issue.

Still, in a statement later in the day, Herbert expressed outrage.

"I am outraged that a convicted child sex offender, currently facing another round of accusations, could be released without being tried for current charges," the governor said. "That is not justice ... It's outrageous for both the victims and the accused that Mr. Johnson won't get his day in court."