A former North Texas sheriff and some ex-jailers were among 17 people named Friday in a 106-count indictment on charges ranging from having sex with inmates to taking them drugs.

Bill Keating, who was Montague County sheriff from 2004-08, is charged with official oppression and having sex with inmates in April and in the fall, according to the indictment. Keating was not up for re-election because he lost in the primary last spring.

Several women who worked as jailers are charged with having sex with inmates and taking them drugs, cell phones and cigarettes in 2007 and 2008, according to the indictment. Some men jailers are charged with drug possession and with taking inmates banned items.

A couple of inmates are charged with drug possession, according to the indictment.

State District Judge Roger Towery has sealed the names in the indictments until they are arrested, but their jobs and charges were made public.

Keating's attorney Mark Daniel told The Associated Press that his client would surrender "in due time." The indictments against Keating are "kind of silly in the face of the federal investigation, like piling on," Daniel said, declining further comment.

In an unrelated case, Keating, 62, pleaded guilty in January to a federal civil rights violation involving the sexual assault of a woman and is to be sentenced to up to 10 years in federal prison in May. Keating told a woman she would be jailed on drug charges unless she had sex with him.

Montague County District Attorney Jack McGaughey said none of the jailers indicted Friday still work there, but the inmates remain in custody.

"This is one of the biggest investigations we've ever been involved in and one of the biggest indictments in the county," McGaughey said Friday. "This was going on for a long period of time, and these indictments will reveal what was going on over there."

Late last year the FBI raided the Montague County jail, about 65 miles northwest of Fort Worth, but authorities have declined to say what prompted the investigation.

Sheriff Paul Cunningham closed the jail and transferred inmates to a nearby facility hours after he was sworn in Jan. 1. That's when he discovered that surveillance cameras' cords had been disconnected; recliners were in cells; some bathrooms and cells could be locked from the inside; and inmates had made partitions out of paper towels to block jailers' view inside their cells, he said.

Official oppression is a Class A misdemeanor, which carries a maximum penalty of a year in jail. Improper sexual activity with someone in custody is a state felony, which carries a maximum penalty of two years in state jail.

Providing drugs or other prohibited substances to inmates and drug possession in a jail are both third-degree felonies, which carry a maximum punishment of 10 years in prison.