Woodbridge, Virginia (CNN) -- The police photograph is chilling. In grainy black and white tones, it shows 13-year-old Martin Andrews sitting in a makeshift box, his leg chained. The look in his eyes is one of fear, fatigue and disbelief. He had just been rescued from a nightmare.

"I was abducted by a sexually violent predator by the name of Richard Ausley, who had been twice convicted for sexually assaulting young boys, and he had taken me for eight days," Andrews recalled of his ordeal 37 years ago. "I was left to die."

As a survivor of a sex crime, Andrews is one face of an issue the Supreme Court revisits Tuesday: civil commitment, which allows the government to keep sex offenders in custody even after they have served their sentences. Twenty states have such laws, including Virginia, where Andrews was held captive and repeatedly assaulted.

During Tuesday's arguments, the justices expressed some doubts about whether the state's duty to protect the public from "sexually dangerous" individuals might trump due process.

"Why doesn't the federal government's authority to have custody because of the criminal justice system end when the criminal justice system is exhausted?" said Chief Justice Roberts. "In other words, when the sentence is done?"

"You are talking about endangering the health and safety of people, so the government has some responsibility, doesn't it?" countered Justice Ruth Bader Ginsburg.

CNN normally doesn't name victims of sex crimes, but Andrews, now a victims' advocate, agreed to tell his story.

On the other side of the debate is the first sex offender released from Virginia's civil commitment program, and one of just a handful nationwide.

"I served my time for what I did, and I didn't feel like I should be incarcerated again," said this man, who asked that his identity not be revealed for fear of retribution. "It was a scary thing to know that you could be committed to a mental institution for the rest of your life."

The man said mandatory therapy helped him, but he thinks that could have been initiated while he was in prison.

There is widespread disagreement on whether civil commitment is a Catch-22. In discussions of the effects of sex crimes, nothing is simple or dispassionate.

The practice of confinement in mental hospitals or treatment centers for those with severe mental illness has been around the United States since its founding. Around the turn of the 20th century, many laws dealing with sexual psychopaths were passed. Over the decades, the laws were repealed or rarely applied.

Then, in 1990, Washington state became the first to pass an innovative civil commitment law specifically for violent sex offenders. California, Wisconsin and New York, among others, later followed. Such "predator laws" focused on risk assessment and prevention of re-offending. It is a concept that the general public may not be aware exists.

The Supreme Court has upheld the use of such laws when the individual goal is rehabilitation, not further "punishment." But it has another, broader purpose.

"The primary goal is incapacitation, that is, protecting society from people who are predicted to be dangerous in the future," said Eric Janus, author of "Failure to Protect" and dean at William Mitchell College of Law in St. Paul, Minnesota. "The second goal is to provide treatment to these individuals."

Critics of these programs say behavioral rehabilitation centers amount to prisons, are often overcrowded and understaffed, and rarely meet the stated goal of treating the "worst of the worst" offenders to the point they can rejoin society.

"The evidence is showing that it's only becoming a detainment center for people they do not went on the streets," said Derek Logue, a sex offender who was released and now advocates for offender rights through his Web site, oncefallen.com. "They have no hope of getting out, and the odds are stacked against you."

According to Justice Department statistics, 20 states use civil confinement, involving about 4,000 rapists, pedophiles and other sex offenders nationwide. Estimates are that these programs cost taxpayers more than $700 million a year, almost $150,000 per individual. That is about four times more than confining them in prison.

Virginia passed its civil commitment law in 1999 but had never fully funded it. Andrews found out from a reporter in 2002 that his attacker was just weeks away from being released after 29 years behind bars. Once a victim, now an empowered advocate, Andrews realized he had to act.

"I didn't know about other sex offenders. I didn't know about the extent of the problem. I only knew one, but I knew that one needed to be dealt with," Andrews, 50, said from his northern Virginia home, where he works as a program manger for a defense contractor. State officials, he said, "all told me there was nothing to be done; he was going to be set free; that was it."

But Andrews mobilized, lobbying lawmakers to quickly fund the program, despite a budget shortfall. It worked, and the state has become a national model, using a tool called "Static 99" that assesses which offenders qualify for civil commitment.

Andrews' attacker remained behind bars but was killed by a fellow inmate before ever going into the treatment program.

The catalyst for the state's change were once-dormant memories for Andrews, who now knew that he had to tell his story.

As a teenager in Portsmouth in 1973, Andrews was walking to the store in snowy weather when a van pulled up and the man inside asked the boy whether he wanted to earn some extra money moving furniture. Andrews agreed but instead was taken to a rural area and a metal box dug into the side of a hill.

"He looked at me, and he said, 'I've got bad news for you. You've just been kidnapped.' "

What followed was days of brutal rapes and beatings. Ausley eventually left, and Andrews would certainly have died if some rabbit hunters had not stumbled upon him after hearing his screams.

Andrews believes that civil commitment is not the best tool, but for the most dangerous predators, "it is the only tool we have that is 100 percent effective, because they are removed from society. They are removed from their triggers."

The case before the Supreme Court on Tuesday deals with a federal law that has kept as many as 77 inmates held in federal prison in North Carolina under indefinite commitment.

The justices will decide whether the program enacted under the Adam Walsh Child Protection and Safety Act of 2006 is constitutional by infringing on a traditional state function. The law was named after the son of "America's Most Wanted" host John Walsh.

The justices said in 2007 that a Kansas law was neither double jeopardy (second criminal punishment for the same crime) nor "ex post facto" (new punishment for a previous crime).

During the hourlong arguments, U.S. Solicitor General Elena Kagan said she recognized civil commitment is normally handled by the states. But she noted federal authorities have the power and responsibility to keep sexual predators off the streets.

"The federal government has mentally ill, sexually dangerous persons in its custody," said Kagan. "It knows that those persons, if released, will commit serious sexual offenses. And it knows too that states are often not in a position to deal with such dangers, not in a position to take custody and care and responsibility for those persons upon release from federal prison."

Alan DuBois, attorney for the federal prisoners, said it was wrong for the United States to claim a public safety argument when justifying continued incarceration.

"The government's argument essentially collapses into the notion, well, if it's a good idea, it must be necessary and proper to do it. I think that is just simply not correct," he said.

"This statute is not written constitutionally," he added. "It effectively does require no connection between the underlying criminal charge and the subsequent commitment. You can be in custody for any crime whatsoever. "

Courts have been at odds in the past with what kind of treatment must be provided and to what extent to pass constitutional muster.

Janus worries about the slippery slope if such laws -- federal or state -- are allowed to continue without strong judicial checks.

"The main danger of civil commitment of sex offenders is that it provides a precedent for doing an end run around those governmental protections, and we all may be comfortable right now because we say, 'Well, this is those people. It's not us. It's not our rights that are at stake,' " he said.

"I think we all ought to be cognizant of the fact that these laws set a precedent that greatly expands the power of government to take away our liberty, not for something we've done in the past, not after we've been convicted and punished, but out of fear that we might commit a crime in the future, and this is a very very powerful and dangerous idea," Janus said.

The white-haired man sitting with his lawyer outside Richmond says he is no longer a danger to society. He served nearly eight years in prison for molesting three girls and nearly five years in forced civil commitment. Despite that state confinement, including being the first of only about four men to be released from it, he says post-prison treatment helped him.

"I think that civil commitment is unfair," he said. "I'm not against treatment. I have done everything in my power to help myself" understand the effects of sexual abuse.

He said that being told just days before his scheduled 2003 release that he was being civilly committed left him feeling "hopeless."

Shortly afterward, the man castrated himself with a razor in his jail cell. After the transfer and years in the rehabilitation unit, he was freed and lives a quiet life -- albeit under constant electronic surveillance -- with no further reported incidents, says his attorney.

Lawyer David Hargett convinced the Virginia Supreme Court that his client had a constitutional right to contest his civil commitment.

"I have found talking with people they are shocked to hear somebody can be sentenced by a judge, serve out that entire sentence and then say, 'Wait a minute, we're not going to let you go,' " Hargett said, calling it a legal "black hole."

"This treatment facility ... is a prison, let's be honest. It has barbed wire and locked doors." He said most in the Virginia facility realistically will never get out.

The high court case is U.S. v. Comstock (08-1224).