LITTLE ROCK, Ark. — An Arkansas judge who gave lighter sentences to men guilty of minor crimes in return for nude photographs or sexual favors could get a bit of leniency himself after admitting Thursday that he engaged in what one state official called one of Arkansas’ worst-ever cases of judicial misconduct.

Joseph Boeckmann had faced possible sentences of 260 years in prison and $2.5 million in fines if convicted of all charges in a 21-count indictment alleging he abused the power of his office for years. He pleaded guilty to two counts under a plea bargain that calls for him to face about 2½ to 3 years in prison for wire fraud and witness tampering.

U.S. District Judge Kristine Baker accepted Boeckmann’s guilty plea but warned that she is not obligated to impose the recommended sentence. Federal prosecutors said they would drop 19 other charges after Boeckmann’s sentencing, which will likely occur in 2018. The plea agreement places fines in the range of $10,000 to $100,000.

Boeckmann spoke only briefly during Thursday’s hearing. “Yes, ma’am,” he said after a series of four questions on whether he understood the deal and agreed to be bound by it. He told the judge later that he was pleading guilty because he was guilty.

He and lawyer Jeff Rosenzweig declined comment outside court. Baker said Boeckmann could remain free pending sentencing, though he still must stay away from Wynne, where he held court in eastern Arkansas until last year.

The 71-year-old’s raised right hand shook as he swore to answer questions truthfully. He carried a cane, though he didn’t always use it.

As a district court judge in Cross County, 100 miles east of Little Rock, Boeckmann mainly handled lower-level offenses such as traffic tickets and misdemeanors from 2008 to last year. Dozens of men who had passed through his court accused the judge of misconduct dating to his time as a prosecutor decades ago. Some said they posed nude in exchange for money to pay their fines.

Attorney Peter Halpern of the U.S. Department of Justice told Baker that Boeckmann had arranged for a third party to threaten a man who had complained about the abuse to state investigators. Boeckmann admitted doing so Thursday.

According to Halpern, Boeckmann would typically offer men a sentence of “community service” in lieu of court fines and fees — picking up bottles and cans while Boeckmann took photographs. An investigation by The Associated Press into court and law enforcement records last year showed that of the 254 men Boeckmann sentenced to community service over a seven-year period in one of three districts he oversaw, just 13 of the cases included timesheets and court records showing completion of the sentences.

Prosecutors said the judge committed fraud by “corruptly using his official position as an Arkansas district judge to obtain personal services, sexual contact and the opportunity to view and to photograph in compromising positions” men who appeared before him in court, at times communicating across state lines. He later falsely said the defendants had satisfied their obligations.

The head of the Arkansas Judicial Discipline and Disability Commission, David Sachar, had called Boeckmann’s actions among the worst cases of judicial misconduct in state history.

“Joseph Boeckmann has finally had his day of reckoning. He always said the truth would come out,” Sachar said. “Any victory over public corruption belongs to the people.”

Sachar, who had been subpoenaed to appear at Boeckmann’s trial had it occurred, said he wouldn’t second-guess the suggested sentence, but noted Baker has a right to stray from the guidelines.