Image copyright ABC Image caption Mayor Charles Wasko has said the he does not regret the racist posts

A town mayor in the US state of Pennsylvania has quit following uproar over his racist posts on Facebook.

The council in West York unanimously accepted Charles Wasko's resignation offer on Monday night, prompting applause from a crowd in the chambers.

The Republican was censured by the council this month for his posts, some depicting apes and lynching.

Mr Wasko, who is white, said he was the target of a "witch hunt", but acknowledged making the posts.

In June he uploaded a photo of orangutans in a wheelbarrow, captioned: "Aww... moving day at the Whitehouse has finally arrived."

"Not soon enough!" Mr Wasko commented on the image, which had the phrase "Kenya or bust" superimposed on the hand cart.

Image copyright AP Image caption The West York borough council invited residents to respond to the mayor at a town meeting earlier this month

He said he was being targeted unfairly due to a fight with the police chief in the town of around 4,500 residents.

But in an interview this month with Pennsylvania TV station WHTM, Mr Wasko said: "The racist stuff, yeah. I'll admit I did that, and I don't care what people label me as."

Much of his Facebook activity has also targeted Hillary Clinton, the Democratic presidential candidate, or expressed support for Republican candidate Donald Trump.

Several of Mr Wasko's posts make sexist comments regarding the appearance of Democratic female politicians, and others mock proponents of gun control.

Image copyright AP Image caption Many residents angrily called for the mayor to resign

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.

More on race in America: The white supremacist thankful for Trump