A Republican mayor in Maine resigned on Friday after a woman he was having an affair with released a racist text message he sent her, according to several local media reports.

Shane Bouchard, the mayor of Lewiston, Maine, referred to elderly black people as “antique farm equipment,” according to the local Sun Journal citing messages that his girlfriend Heather Berube Everly made public. Bouchard resigned Friday morning and told a local CBS affiliate that he made mistakes and was not a “perfect person.”

“In this political climate where the media does not discriminate between facts and rumors, it is hard to be a public figure. I am not a perfect person. I have made many mistakes in my past. I have also, in the past been the victim of some very damaging rumors,” he told the local WGME.

The resignation comes just after the same woman, Berube Everly, testified at the Lewiston City Council meeting this week that she provided the mayor with internal emails from his opponent’s campaign, where she was working at the time. Those emails were later published on a website called the Maine Examiner, which was later revealed to be run by an operative for the Maine Republican Party.

After Berube Everly’s testimony, Bouchard admitted to WGME that he received the leaked emails from Democratic opponent Ben Chin’s campaign, but denied that he gave them to the Maine Republican Party. Local police are reportedly investigating the leaked emails.

The internal emails show Chin referred to some voters as “assholes” and was opposed to a merger between two towns because it could lead to spending cuts.

Watch Berube Everly’s testimony before the city council below: