The mayor of Maine's second largest city has resigned in the wake of a controversy over his leaked text messages, one of which included a racist remark.

Republican Shane Bouchard stepped down as Lewiston's mayor, effective immediately Friday morning. Text messages made public by a woman who said she had an affair with Bouchard when he was a mayoral candidate revealed a remark in which he described elderly black people as "antique farm equipment."

Heather Berube Everly said the two had an affair, and that she was the source of emails the Maine GOP used to attack Democratic opponent Ben Chin.

Bouchard admitted making mistakes but also decried media reporting on "rumors."

Everly said her affiliation with Chin and the Maine People's Alliance helped Bouchard's campaign.

"I did work with Ben Chin as a recruiter with MPA," she said during a Lewiston City Council meeting. "I connected with Mayor Bouchard, where I had an affair with him, and he was able to retrieve emails from MPA's and Ben Chin's campaign."

During his 2017 campaign against Bouchard, Chin said hundreds of his campaign signs were stolen. In 2015, when he was facing Mayor Robert Macdonald, a landlord posted signs reading "Don't vote for Ho Chi Chin," which Chin criticized as racist.

In the intial November election of 2017, Chin's 4,239 votes led Bouchard's 2,979. A month later, Bouchard defeated Chin by a much narrower margin of 145 votes, with the Republican receiving 3,663 votes to the Democrat's 3,518.

"The Republican Party has, through Mayor Bouchard, rigged the election," Everly said. "They interfered and affected results, and they were also able to influence the votes of people, especially in the ward that I was in."

The attorney general's office confirmed Friday that it's assisting a Lewiston Police Department investigation into the matter.