FAIRFIELD — He was a successful New York accountant and commercial real estate broker, but Charles Lawrence III is behind bars Friday because he claims eye problems caused him to misread a text and believe he was about to have sex with an 18-year-old instead of a 13-year-old boy.

“The text he received had a one and a three which he mistook for a one and an eight,” Lawrence’s lawyer, Edward Gavin, told Superior Court Judge Robert Devlin.

“I am not a pedophile,” added the 60-year-old Lawrence. “I used poor judgment but I have never seen, used or downloaded child pornography in my life.”

But Devlin said he wasn’t buying it and sentenced Lawrence to two years in prison in the case involving a Fairfield minor.

“The thing about this case is it has this Shakespearean quality to it, or maybe a Dr. Jekyll and Mr. Hyde aspect,” the judge said. “But this whole case is about protecting children. You did a bad thing here.”

In addition to the sentence of eight years, suspended after Lawrence serves two years in prison, the judge ordered him to register as a sex offender.

Lawrence was one of 10 men snagged in a sting last October at a house in Fairfield.

The sting, set up by TV newsman Chris Hansen, Fairfield Police and State’s Attorney John Smriga, had Fairfield University theater students posing as 13-year-old boys and girls.

When the suspects showed up at the house to have sex with the teenagers they were arrested and the incident was video recorded for a later television program.

Smriga told the judge that beginning in September 2015, Lawrence began communicating through the Internet site Grindr with what he thought was a 13-year-old boy.

Lawrence inquired about the boy’s sexual desires and told him he could be is teacher, the prosecutor said.

At about 3:45 p.m. on Oct. 3, Smriga said Lawrence arrived at the decoy house and was subsequently arrested.

On his person police found a bottle of lubricant and a bottle of nail polish remover, the prosecutor told the judge.

Lawrence subsequently pleaded guilty to second-degree attempted sexual assault, attempted risk of injury to a minor and enticing a minor to have an obscene performance.

Gavin told the judge that the irony of the situation is that his client knows Chris Hansen socially, commuted daily on the train with him and was aware of Hansen’s TV program, To Catch a Predator.

“After he was caught Charles sat down with Fairfield police and told them, “I thought I was going to meet an 18-year-old,” Gavin said.