BUFFALO, N.Y. — Despite some strongly expressed reservations, a judge on Friday stuck to his word and allowed a Cheektowaga man to avoid state prison after that man admitted to trying to molest children.

Under a plea bargain, State Supreme Court Justice William Boller sentenced Michael Henry, 65, to 10 years’ probation, the first six months of which will be served in the Erie County Holding Center.

With good behavior Henry will be released in four months.

Henry, who could have gotten eight years in state prison if convicted at trial, plead guilty in April to two felony counts of Attempted Course of Sexual Conduct Against a Child.

Henry admitted that over the course of two years he had been to attempting to engage in sexual conduct with two pubescent girls.

“This plea was offered with the consent of the victims, and they were aware of your honor's sentencing commitment at the time of the plea,” Erie County Assistant District Attorney Kate Lavin told the court prior to sentencing. “That was mainly to bring closure to the victims in this case.”

However, Boller upon reading the complete probation report filed with the court after Henry entered his plea, indicated that he likely would not have agreed to the promised six-month sentence had he been aware of its contents.

“There’s so many people that I know that if you told them the facts, they'd wanna break your neck," Boller told Henry. “If this happened to my daughter, or this happened to my granddaughter, you wouldn't be here. I would be charged with a penal law violation of assault or worse."

Henry's lawyer reminded the judge that his client, even though no complaint had ever been filed against him, went to Cheektowaga Police of his own volition to report his behavior.

“He was the person who went to law enforcement. He accepted responsibility," said attorney Frank Bogulski, who also reminded the judge that despite the contents of the pre-sentence report, it ultimately recommended that his client be granted probation.

“I’m very sorry for what I did,” Henry told the court, when afforded the opportunity to speak prior to sentencing. “I am getting counseling and making sure that I get that counseling because I need it.”

Justice Boller told Henry he was tempted to renege on the agreement he made to a sentence of no more than six months.

“Today I was prepared to sentence you to two years on each count to run consecutively. That's a total of four years,” Boller said. “But I was barred from doing it because I gave a commitment.”

It was a commitment the judge ultimately stuck to, but not without warning Henry that he had better stick to his commitments while on probation, including to abide by an order of protection to keep away from the victims.

"Because if you don't like the holding center for six months, you're gonna hate state prison with the big boys," Boller said. “So this will help you stay the track ... because what you did was unconscionable."

RELATED: 15-year-old teen charged with making terroristic threats against multiple students at Olean Central Schools

RELATED: Buffalo woman facing DWI charges following hit-and-run accident in Clarence

RELATED: Franklinville pair arrested in connection with 2015 fatal car crash