An Alexandria deputy sheriff resigned this summer amid an investigation that later found that while he was on duty at the city jail, he had sex with a female inmate.

No criminal charges were brought because the inmate had consented to having sexual relations, according to Sheriff James H. Dunning, who confirmed the resignation.

Dunning said that as a result of the incident, he created a policy prohibiting male deputies from entering the female section of the jail alone.

Duties there are now performed by a female deputy or by a minimum of two male guards at a time, he said.

"Every now and then it comes to our attention that we have a bad apple," Dunning said. "When we find it, we investigate it and we get rid of it."

Dunning said he learned of the incident in July, "a few days" after other inmates reported it to jail staff members. The incident occurred in the inmate's cell during the night, he said.

The deputy, who had been on the force several years, but whom Dunning declined to name, was immediately suspended and an investigation was begun. He resigned before the investigation was completed, Dunning said.

The findings of the investigation were referred to Alexandria Commonwealth's Attorney John E. Kloch, but the prosecutor found no criminal violation because the inmate said she had consented, the sheriff said.

In an unrelated case, attorneys for Dunning and a Prince George's County woman reached an out-of-court settlement Tuesday in a $6 million lawsuit filed after the woman was inadvertently locked in a holding cell for a weekend by a deputy sheriff last year.

Both sides have declined to say how much money the woman, Cassandra Jones, 26, received in the settlement.