Richard A. Schmidt is shown in this passport page from his canceled passport, included in a court filing from his case ( /U.S. District Court)

An appeals court on Wednesday reinstated the conviction of a serial child molester from Maryland whose case was held out as a major success of a law to punish sexual predators overseas.

The unanimous decision by the U.S. Court of Appeals for the 4th Circuit reverses an earlier ruling and means the former Maryland schoolteacher set to be released from prison this month will have to register as a federal sex offender.

In an 11-page ruling, the three-judge panel said Congress intended to give prosecutors more power to pursue U.S. citizens such as Richard A. Schmidt who molest children in foreign countries.

“It was aimed in part at the ‘ugly American,’ whose sexual exploits and visitation to sexual guesthouses abroad have helped to stimulate the sex trade in young children,” wrote Judge J. Harvie Wilkinson III, who was joined by Judges G. Steven Agee and Pamela A. Harris at the Richmond-based court.

Schmidt was arrested repeatedly in the 1980s for molesting young boys in Maryland and served more than 12 years in prison. After his release in 2002, he was accused of violating parole and fled to the Philippines and later to Cambodia, according to court records.

In Southeast Asia, Schmidt was arrested again for abusing young boys. He was deported to the United States, pleaded guilty and was sentenced to 15 years in federal prison, which he is about to complete.

Schmidt argued, and a federal judge in Baltimore agreed in 2015, that he did not break U.S. law because the crimes he pleaded guilty to overseas did not happen in the first country he visited after leaving U.S. soil but occurred during his second stop.

Schmidt’s attorney said during appeals court arguments last month that his direct connection to the United States — and to prosecutors’ reach — ended after he left the Philippines and that he intended to cut his ties to the United States.

The appeals court agreed that prosecutors do not have the authority to go after U.S. citizens with no connection to this country. But the judges concluded that in Schmidt’s case, he was still traveling from the time he left the United States until the time of his illicit conduct in Cambodia and is, therefore, “not actually innocent.”

In both countries, Schmidt traveled on tourist visas, maintained money in a U.S. bank account and never purchased a home or other property abroad.

“At all times, he was a visitor in both the Philippines and Cambodia,” the court said. “Contrary to his protestations of permanency, Schmidt was something of a rolling stone.”

Even before the 2015 ruling by U.S. District Judge J. Frederick Motz in Baltimore, Schmidt was scheduled to be released Jan. 20, according to federal Bureau of Prisons records.

If Motz’s ruling had stood, prosecutors were concerned that Schmidt would not have been supervised or registered as a sex offender after his release.

The appeals court decision Wednesday ensures that Schmidt will have to register and be subject to a bar on applying for a new passport and having unsupervised contact with children.

Authorities are working on a separate track to have Schmidt civilly committed to the custody of a psychiatric facility after a prison evaluation that he is a “sexually dangerous person.” The civil legal proceeding is pending before a separate panel of judges at the 4th Circuit.

Maryland U.S. Attorney Rod J. Rosenstein said Wednesday that his office has been so persistent about the case because Schmidt is a “repeat sex offender who would pose an extreme danger to children if he were released.”

Schmidt’s attorney Mary E. Davis said she will likely seek review of Wednesday’s decision by a full panel of the appeals court.