A veteran Salem cop — and husband of the city’s police chief — resigned from the department two days after he was arrested for allegedly raping a male inmate in a station broom closet on Halloween, the city’s solicitor said yesterday.

Brian Butler, the spouse of Police Chief Mary E. Butler, resigned Nov. 10, Salem City Solicitor Beth Rennard told the Herald.

Butler, a father of three and 24-year veteran of the police force, was freed on a $10,000 bail after his arraignment in Salem District Court on charges of rape and indecent assault and battery. Brian Butler will receive his accrued 37 days of unused vacation leave, Rennard said.

The alleged rape occurred the morning of Halloween. The accuser was in protective custody after allegedly getting drunk and flooding a motel room bathroom at the Clipper Ship Inn. He was naked in his cell because his clothes were wet.

“I am embarrassed and I gave into temptation,” Brian Butler allegedly told a captain who confronted him. “I’ve embarrassed myself, my family and the police department … I’ve ruined a 24-year career.”

Chief Butler, who took vacation time off after the incident, returned to work last week.

The accuser said in an affidavit to Salem Police Internal Affairs he allowed Brian Butler to fondle him at a booking desk and rape him in a broom closet “out of fear.”

Portions of their interactions were captured by station surveillance video and audio that state police said appears to “corroborate” the accuser’s story.

Rennard said if Brian Butler files for retirement he may be eligible for a sick leave buy-back through collective bargaining.