Three male and three female inmates at a southern Indiana jail face charges that they devised a way to sneak between cell blocks to help pass their time behind bars by having sex.

The inmates figured out how to remove metal ceiling panels in the Greene County Jail and used the passageway more than a dozen times in September and October, according to court documents.

The men — ages 44, 38 and 17 — and the women — ages 27, 26 and 21 — crawled through the ceiling after midnight, having sexual encounters and drinking homemade alcohol that was found hidden in the male cell block, a police affidavit said.

One male inmate who was not charged said the female inmates would "hang-out, play cards or have sex with some of the male inmates" in their cell block, the affidavit said.

The inmates were able to find a security camera "blind spot" where they could remove ceiling tiles and create a passage between the cell blocks, Sheriff Terry Pierce said Tuesday.

The inmates used a shower drain as a tool to loosen security screws and the ceiling tiles were carefully replaced so they did not appear to be disturbed, Pierce said.

"We could not see it," he said.

The ceiling panels have since been secured, and Pierce said he was seeking funding to improve security at the jail, which was built in 1994 in the city about 25 miles southeast of Bloomington.

Pierce called the inmates' activities "embarrassing" to himself and his staff.

"If your facility has a flaw, if you house prisoners in it, they will show you. They will find it," he said. "We're going to have to find a way to have a better security system."

Prosecutors have filed felony escape charges against the six inmates, who were awaiting trial on a variety of charges. Five of the inmates remain in the Greene County Jail, while one has been transferred to the Monroe County Jail in Bloomington.

Pierce said the investigation is ongoing and other current or former jail inmates may be charged.