Updated

A former United Nations weapons inspector who exchanged explicit online messages with a detective posing as a 15-year-old girl and then performed a sex act on himself in front of a webcam was sentenced Wednesday to at least 1 1/2 years in state prison.

Scott Ritter, 50, was taken into custody immediately after Monroe County Judge Jennifer Sibum sentenced him to 18 to 66 months behind bars. It was the second time in eight years that Ritter, of Delmar, N.Y., found himself in legal trouble for trying to lure underage girls into illicit sex.

Ritter, who maintains his behavior was shameful but not criminal, must register as a sex offender under Pennsylvania's version of Megan's Law.

"I had no business being in a chatroom on Feb. 7, 2009," Ritter told the court Wednesday. "I've asked my wife for forgiveness, and I've asked my daughters for forgiveness, and they have given it to me."

Ritter contends that he believed the person he met in a Yahoo chat room in 2009 was an adult acting out her own fantasy.

The judge acknowledged Ritter's service to his country and his support network of friends and family but criticized him for failing to take responsibility for his conduct.

"I think what it would be like if it were my niece, Mr. Ritter's daughters or someone else's daughter in this very courtroom who was on the receiving end of that chat," the judge said. "Children need to be protected."

A jury convicted Ritter on six counts, including unlawful contact with a minor. He plans to appeal the conviction and sentence.

Ritter's attorney asked the judge on Wednesday to grant a new trial, basing the request on an appeals court ruling in New York last week that records from two previous incidents in that state in 2001 should not have been unsealed and given to prosecutors in Pennsylvania to be used at his trial.

Attorney Gary Kohlman argued the New York ruling entitled Ritter to a new trial because prosecutors based much of their strategy on the argument that Ritter had a history of preying on underage girls.

"It became, as I feared, the tail that was wagging the dog at trial," Kohlman said in court.

Assistant District Attorney Michael Rakaczewski argued the New York ruling had no bearing on Ritter's conviction and sentence in Pennsylvania. The judge rejected the defense request for a new trial, saying Kohlman could bring up the New York case on appeal.

Ritter was one of the U.N.'s chief weapons inspectors in Iraq from 1991 to 1998. He resigned after accusing the United States and the U.N. of failing to get tough with then-Iraqi leader Saddam Hussein. Later, he said Iraq had destroyed its weapons of mass destruction, and he became a vocal critic of the U.S. invasion.

In 2001, Ritter twice arranged to meet people who claimed online to be underage girls but who turned out to be undercover police in Colonie, N.Y. The charges were eventually dismissed, and the case was sealed, but Pennsylvania prosecutors obtained the records and used them to try to show Ritter has a predilection for minors.

Ritter told jurors at his April trial that he knew he was chatting with undercover police and set up the meetings so he would be arrested. Kohlman has said Ritter used sexually explicit chats on the Internet as a way to handle his depression over being called unpatriotic for his criticism of American policy on Iraq.

A member of Pennsylvania's Sexual Offenders Assessment Board, Paula Brust, testified Wednesday that based on his history Ritter is at risk to offend again.

"He is not able to manage his offending in the community despite sex offender treatment," she said.

Ritter's therapist, Richard Hamill, acknowledged in court Wednesday that Ritter left treatment after the 2001 incidents. But he said Ritter's problem involves a compulsion to masturbate in front of adult women -- not minors. He said Ritter has been attending weekly group therapy sessions since February of 2009 and presents a low risk of reoffending.