The sheriff of Custer County resigned on Wednesday just as federal prosecutors filed 35 felony counts against him for allegedly running a sex-slave operation at the jail.

Mike Burgess quit the position he'd held since 1994 shortly before appearing in court on 14 counts of second-degree rape, seven counts of forcible oral sodomy and five counts of bribery by a public official.

Burgess surrendered to Oklahoma State Bureau of Investigation agents and was released from custody after posting $50,000 bail. He could not be reached for comment.

Among other things, Burgess is accused of having sex with a female drug court participant who was in his custody. The crimes allegedly occurred between October 2005 and April 2007.

A federal lawsuit filed in October claims Burgess told one drug court participant he would have her sent to prison if she didn't comply with his sexual demands.

The lawsuit, filed by 12 former jail prisoners, alleges the sheriff's employees had them engage in wet T-shirt contests and offered cigarettes to those who would flash their breasts.

One prisoner alleged she became a jail trusty with more freedom after agreeing to perform a sex act on Burgess, but lost that status when she later refused.

Burgess also faces two counts each of sexual battery, rape by instrumentation and subornation of perjury. Also filed were one count each of engaging in a pattern of criminal offenses, indecent exposure and kidnapping.

Special prosecutor James Boring said Burgess could be sentenced to 467 years in prison if convicted on all 35 counts.

Custer County Commissioner J.M. Kelly said the day-to-day operations of the sheriff's department will be managed by undersheriff Kenneth Tidwell.