Virginia lawmakers have unanimously approved money to finance a new program that sends some child molesters, rapists and others convicted of violent sexual crimes to state-run mental institutions as soon as they are paroled or finish their prison terms.

Under the program, those committed to an institution are held indefinitely, subject to recommendations by doctors and a decision by a judge. Proponents define the lockup as treatment for a mental illness that makes the felon likely to commit a sexual assault again, rather than as a second punishment for the same crime.

Gov. Mark R. Warner (D) has said he favors the idea, though he initially supported a program that would have applied to fewer than five prisoners a year. His proposal would have required the state to commit only those who were repeat offenders, having been convicted of a sex offense, served time and then been convicted again.

Lawmakers broadened the scope of the program. State officials say they are not sure how many of the 250 violent sexual offenders due to be released this year would be committed under the new program. The $1.2 million included in the state's two-year budget would finance a treatment facility, guards, doctors and care for fewer than a dozen a year.

A Warner spokeswoman said the governor will likely seek to narrow the legislation in March before he signs it, to make sure that treating the number of institutionalized felons does not cost more than $1.2 million.

"I want the bad guys, who we all know are going to repeat," said House Majority Leader H. Morgan Griffith (R-Salem), who has campaigned for years to lock up what he calls sexually violent predators. "Those are the ones we want."

But civil libertarians say the program threatens to become a routine way of keeping a larger number of violent criminals behind bars forever, even after their prison sentences have been fully served and their debt to society officially paid.

Kent Willis, executive director of the Virginia chapter of the American Civil Liberties Union, said convicted felons will not have a fair chance to avoid being committed under the new program.

"One of the fundamental notions of modern criminal justice is that sentences are to be a specific amount of time. You cannot say your sentence is however long we want to keep you in jail," Willis said. "On paper, this is the kind of law that looks like due process is in place. But it's really a railroad to a mental institution."

Sen. Kenneth W. Stolle (R-Virginia Beach), who sponsored the bill in the Senate during the session that ended last week, said he nonetheless has reservations. He said the law must be aimed "with laser-like precision" only at felons the state can prove will repeat their crimes. And he said the promise of treatment for their mental illness must be kept.

"You can't just isolate these people," Stolle said. "You actually have to try to rehabilitate these people, before they are committed, and you have to have a real effort to treat them afterward. You can't just have a pretense."

Under the Virginia plan, prosecutors will start proceedings against felons a year before they are due to be released. A committee will recommend to the attorney general which felons are likely to be a danger to society, based in part on tests given by psychologists during the original sentencing.

The attorney general will then decide which of them to take before a judge, who makes the final determination at a hearing. Attorney General Jerry W. Kilgore (R) pledged today to seek confinement to an institution for almost every case that he gets.

"If . . . it looks like this guy could be a danger, we will go forward," he said. "I make no apologies for that."

About a dozen states have enacted similar laws. A Kansas statute was upheld as constitutional by the U.S. Supreme Court, which said criminals who commit certain sex crimes may be sent to institutions as long as prosecutors have valid psychiatric reasons and provide appropriate treatment.

When the law passed in Virginia for the first time in 1999 -- without any money to operate -- it was opposed by nearly a third of the House of Delegates.

This year, the House reaffirmed the legislation by a vote of 99 to 0 and provided the money to start sending felons to institutions right away. It passed the Senate 40 to 0.

"I think people's comfort level has increased as time has gone on," said Del. James F. Almand (D-Arlington), who voted against the bill in 1999 and for it this year. "There's a group of people who are going to continue to repeat. You want the criminal justice system to deal with those people."

The program's unanimous support this year, its supporters and critics say, is in part due to the impending release of Richard Ausley, a serial child rapist, and the intensive lobbying by one of Ausley's victims, a computer programmer who was chained in a box in the ground and raped repeatedly when he was 13.

Ausley, 63, who served almost 30 years for the abduction and rape of Paul Martin Andrews in 1973, is set to be released on parole in April. He was convicted before Virginia eliminated parole in the mid-1990s.

Andrews, 43, who now lives in Miami, spent most of the last two months talking to Virginia lawmakers about the new program.

"It's the only way we can keep these dangerous individuals off the street," Andrews said. "If you have a bad dog and you let the dog out to run and he bites someone, whose fault is that?"

Andrews said he recognizes that the Virginia law may not seem fair to some people. But he said the system is designed to guard against people like Ausley, who had been convicted of two child rapes before abducting Andrews.

"I agree, the deck is stacked against them," Andrews said. "But it's because of them. They are the ones that committed these acts."

House Majority Leader H. Morgan Griffith: "I want the bad guys, who we all know are going to repeat."