Ukip councillor Eric Kitson resigned after sharing posts calling for Muslim women to be hanged. .

Nigel Farage, the Ukip leader, has suffered his first setback since his party swept almost 25% of the vote in local elections after one of his newly elected councillors resigned over racist comments he posted on the internet.

Eric Kitson, Ukip's councillor for Stourport stood down less than two weeks since being elected after anti-Semitic and Islamophobic messages he posted on Facebook came to light.

One post featured an image of a nuclear bomb accompanied by the words: "Some cancers need to be treated with radiation. Islam is one of them."

Kitson, 59, also shared an image of a Muslim being roasted over a pile of burning Korans, as well as a string of anti-Semitic comments linking the Rothschild banking dynasty to Adolf Hitler.

In one comment, he said of Muslim women: "Hang um all first then ask questions later."

In another he called for a referendum to set up an English parliament, Britain's withdrawal from the European Union and the deportation of "six million migrants and refugees".

Kitson's resignation will trigger a by-election in his Wyre Forest seat, less than two weeks after UKIP won its first four seats on Worcestershire County Council.

Ukip spokesman Gawain Towler said: "We believe Eric Kitson is an honest man who has made, by his own admission, some serious mistakes by posting or reposting offensive material on his Facebook which he should never have associated himself with.

"He regrets this enormously and rightly so. His decision to resign is, under the circumstances, the right one. UKIP deplores racism or religious intolerance in any form. This is a stark demonstration that people who are careless, unthinking or foolishly provocative in their online activity can both give great offence to others and severely damage themselves.

"Mr Kitson's membership of the party will be considered by the national executive committee who will take into account the outcome of the police investigation now underway."

Kitson, who won 1,385 votes to take Wyre Forest on May 2, had apologised for the messages. But he denied being a racist, saying he only shared the posts to "show how bad they were".

Shortly before resigning, Kitson said: "I thought I could handle politics, but I can't. To say I have been stupid is mild. I do not agree with the comments and I have not got a racist bone in my body. I'm not a racist, all my friends know me better than that.

"What I wrote was stupid, but it wasn't racist. I am not racist. I'm the only white guy on my local five-a-side football team. I went to school with a lot of young Pakistanis and Indians and I have had wonderful Muslim friends over the years."

Kitson, who joined UKIP a year ago, also apologised to his Ukip colleagues. "What can I say to them? The hardest thing to do is say sorry. I cannot blame anybody but myself.

"It is the worst thing that has ever happened to me before and it is my fault. It has made me ill - I cannot eat and I cannot sleep. The people who know me - my family, friends, people I work with - have all supported me.

"I wanted to show people this is bad, this is wrong. What I should have done is write something on them about how bad it is but I didn't."

Kitson has since shut down his Facebook page.

Bill Etheridge, Ukip's chairman for Dudley and Halesowen, said: "UKIP does not condone hate, racism or prejudice. We totally condemn those things because it's not what the party is about. In fact it is the total opposite of what the party is about."

"An investigation is taking place internally into the events and part of that investigation will consider his ongoing membership of the party. The party rules state that extreme views are not compatible so senior level head office members of the party will look at the facts of what has happened here and make their decision."

West Mercia Police confirmed they were investigating the matter after receiving a complaint.

Ukip Polling at All-Time High as Farage Wins over Labour Supporters