A former Ohio mayor indicted on rape charges reportedly confessed that he had sex with a child — a young girl, who, the man claimed, was a willing participant.

Court records filed Monday describe conversations in which Richard Keenan — who briefly served as the mayor of Hubbard — talked to several people, including his wife and a pastor, about alleged assaults that occurred over the course of two years, beginning in 2013, when the girl was 4.

The 65-year-old Keenan, who once described himself as a man of faith, was indicted last month on eight counts of gross sexual imposition, eight counts of rape and four counts of attempted rape.

According to court documents filed by Trumbull County Assistant Prosecuting Attorney Gabriel Wildman, Keenan’s wife confronted him after the girl talked about the alleged abuse.

“I did it,” Keenan told his wife, according to court records.

Keenan was later admitted to Trumbull Memorial Hospital’s psychiatric ward in Warren, Ohio. He said during group discussions there that he had been sexually abusing a child for two years, according to court records.

He was released from the hospital and admitted to the River Bend Treatment Center, where he told an intake social worker that he was feeling suicidal because of his actions and that the girl willingly participated in the sex acts, according to court records.

Keenan talked in more detail with a local pastor about the alleged abuse, saying it began when the child walked in on him in the bathroom, according to court records. It’s unclear how he and the child knew each other.

In a phone conversation with his brother- and sister-in-law, Keenan said he had gone way over the line, court records say.

According to the court records, the alleged crimes began in September 2013, nearly two years after Keenan left the mayor’s office in Hubbard, a small town in northeastern Ohio. The sexual assaults ended in September 2015, according to prosecutors.

Keenan was indicted and arrested Aug. 18. He was released on bond the same day, online jail records show.

His attorney, J. Gerald Ingram, did not return a call seeking comment.

Wildman, the assistant prosecuting attorney, declined to comment on the case.

Keenan, a Democrat, was sworn in as mayor in January 2010 and served until 2011. He previously served as a council member and a probation officer, according to the Vindicator newspaper. He also worked as a car inspector for the CSX railroad company in New Castle, Pa.

“I care about his town,” Keenan said in a 2010 interview with the Vindicator. “I’m pulled to hear the heart of the people.”

At the time, Keenan said he had dedicated his life to Christ — a decision that he said changed his life.

“Don’t preach it, but live it,” he told the paper.

Keenan pleaded not guilty last month. He’s scheduled for a jury trial in April.

His wife could be called as a witness at the trial. According to the Ohio Rules of Evidence, a defendant’s spouse can be a competent witness if the alleged crime was committed against him or her or their child, or if he or she elects to testify.

If found guilty of rape, Keenan could face life imprisonment.