Charles Wasko, as mayor of West York, PA, had a bad Facebook habit, issuing a string of racist and sexist postings that finally cost him his job. He regrets nothing, reports the BBC: "The racist stuff, yeah. I'll admit I did that, and I don't care what people label me as."
His resignation follows public forums in which community members, including young children, called on the mayor to step down.
Democrat Shawn Mauck will now move from the town council to the mayor's office.
"Sadly West York lately has been known primarily for one thing, what residents call 'their racist mayor,'" Mr Mauck said at a council meeting as he accepted the mayor's resignation.
The mayor had said he would only step down if certain conditions were met by the council members.
"The demands were kind of silly childish immature from a guy who's not displayed too much maturity the last couple days," said Mr Mauck.
He would not elaborate on the mayor's demands, but he did make clear they were not met.
ABC News interviewed Wasko earlier this month. Here's a taste: