Jeffrey Hurant, whose online site Rentboy.com made millions advertising gay escort services for nearly 20 years, was sentenced in Brooklyn federal court on Wednesday to six months in prison for promoting prostitution.

Hurant, 51, had asked for no jail time, claiming that his website had improved conditions for gay sex workers by bringing them into the open and telling U.S. District Judge Margo Brodie he had “rationalized” his behavior because it was so rarely prosecuted.

“I beg you to treat me with mercy,” he told the judge.

In a courtroom packed with Hurant’s supporters, Brodie said many users of the Rentboy site had written her praising his decency, but she couldn’t completely ignore the need to send a message discouraging others from flouting the law the way Hurant had.

“What I have before me is two decades of committing a crime, and of Mr. Hurant knowing he was committing a crime,” Brodie said. “That can’t go unpunished.”

Hurant, of New York City, was charged in 2015. Prosecutors described the site as the world’s largest online male escort ad service, running thousands of ads, grossing $10 million in just five years from 2010 to 2015 and even hosting an annual awards show for the best escorts called the “Hookies.”

Sign up to get the latest updates Get Newsday's Breaking News alerts in your inbox. By clicking Sign up, you agree to our privacy policy.

Despite disclaimers on the site, the government said prostitution was obvious — with escorts posting nude pictures, advertising physical attributes and sex acts they would engage in, and listing pay rates up to $3,000 per weekend.

But Rentboy was never accused of more serious crimes involving minors or human trafficking, and as a result the case attracted intense attention from the gay community, legislators and civil liberties advocates concerned that it targeted the gay lifestyle and victimless consensual sex.

At the sentencing, Hurant said he had rationalized his behavior based on his belief that sex work shouldn’t be illegal, but had now outgrown that view. “Though I disagree with the law, I realize that I broke it,” he said.

In an unusual back-and-forth, before imposing sentence Brodie challenged Hurant to tell her why six months was unfair, promising that no matter what he said she wouldn’t go higher.

When Hurant said his life was shattered even without prison, Brodie said that happened to all defendants. He said he forfeited more than $1 million, but she said they were criminal profits. When he said a U.S. prison term wouldn’t send a message to foreign websites, the judge said that wasn’t necessarily true.

“I did the best I could doing good things for people,” Hurant finally offered. “I did not spend 20 years believing I was running a criminal racket.”

“You didn’t want to accept it but you knew people using your site were advertising sex,” Brodie responded. “Although you won’t acknowledge it, you were making a considerable amount of money.”