Two former North Tonawanda men who have been sent to state mental institutions under the civil confinement law for sex offenders must remain where they are, a appeals court has ruled.

Friday, the Appellate Division of State Supreme Court in Rochester ruled unanimously that Michael C. Bass, once described by a state psychologist as “a high-end pedophile,” must remain in the mental institution he was sent to by State Supreme Court Justice Richard C. Kloch Sr. in 2012.

The same court made the same ruling July 3 in regard to Brandon E. Armstrong. Kloch sent him away in March 2013.

Under the civil confinement law, the state Attorney General’s Office is allowed to review the case of any sex offender and prevent him from being released from prison once his sentence has expired.

Instead, the state can ask a judge to consider whether the defendant has a “mental abnormality” that makes him likely to commit more sex crimes. A trial on the question is held, and a jury may be used if the attorneys wish.

If the verdict is that the defendant has a mental abnormality, the court may institutionalize him or allow him to live in the community under a strict probation regimen. Any violations of its dozens of rules can lead to institutionalization.

Although Kloch held those proceedings in open court when the law first went into effect, in recent years judges have been instructed to conduct them in closed courtrooms out of public view.

Bass, now 42, was convicted in 2000 of second-degree kidnapping and sodomy against a 12-year-old boy, whom he took on an eight-day cross-country road trip in 1999. That brought him a 10-year prison sentence.

After he was flagged for civil confinement, Bass at first admitted that he had a mental abnormality, then changed his mind and fought against the program. The state presented evidence that Bass had sodomized some 52 boys before he was caught.

Armstrong, now 28, pleaded guilty in 2003 to having sexual contact with a girl younger than 11 from the summer of 2002 through May 2003. At first he was given a six-month jail term and then placed on probation, but he violated its terms in 2008 and was sent to state prison for 1 1/3 to four years. After that, he was targeted for civil confinement.

Bass complained in his appeal that he was done in by hearsay evidence from one of the two state psychologists who testified against him, but the Appellate Division said the doctors’ statements were backed up by documents and by Bass’ own replies during the doctors’ interviews with him.

The Appellate Division also turned down a hearsay argument from Armstrong, saying that he admitted the truth of the hearsay during his interviews with two doctors. The information included accounts of sex offenses for which Armstrong was never arrested, as well as his probation violations and rule-breaking while in prison.