EASTLEIGH, England (Reuters) - Prime Minister David Cameron's ruling Conservative Party has been beaten into third place in an election for a parliamentary seat, by a party that wants Britain to leave the European Union.
The UK Independence Party (UKIP) has no MPs and Cameron once described its members as "fruitcakes, loonies and closet racists", but its support surged in the Thursday vote in Eastleigh to its highest ever in a parliamentary election.
To compound Cameron's misery, the Liberal Democrat party, the junior partner in his governing coalition, took first place despite being embroiled in high-profile sex and perjury scandals and floundering in national opinion polls.
Nigel Farage, leader of UKIP, said the vote showed his party was on the verge of a "national political earthquake".
"It's a protest against an entire political class who are not willing to confront difficult issues like open-door immigration," Farage told a news conference on Friday.
The result will pile pressure on Cameron from disgruntled lawmakers within his own party who fret he may not be able to lead them to victory in a 2015 national election since, to do so, he will have to win seats like Eastleigh in southern England.
The Conservatives had hoped to win or at least come second, and Cameron is now facing calls to move away from some of his more centrist policies. He played down the defeat on Friday.
"This is a by-election, it's mid-term, it's a protest. That's what happens in by-elections," Cameron said.
"It's disappointing for the Conservative Party but we must remain true to our principles, true to our course, and that way we can win people back. I don't think we should tack this way, tack that way."
Education Secretary Michael Gove said disillusionment with mainstream politics and anger at Britain's economic woes had played a role in the defeat.
PRESSURE ON CLEGG
The result was an important victory for the Liberal Democrats and for Nick Clegg, the deputy prime minister and party leader, who has seen his leadership come under pressure in recent weeks.
They polled 13,342 votes, UKIP 11,571, the Conservatives 10,559 and the Labour Party 4,088. That meant UKIP took almost 28 percent of the vote.
Since becoming leader, Cameron has sought to ground his party in the centre of British politics, but some Conservatives believe in doing so he has alienated traditional supporters over issues such as his support for gay marriage, which UKIP opposes.
"He took the base of his party for granted and just reached out with centrist messages. He sowed the seeds for the problem he now has, which is this growth of UKIP," said Tim Montgomerie, editor of the influential ConservativeHome website.
"I don't suspect UKIP will take a single seat at the next general election. But if they win six, seven, eight percent of the vote which opinion polls and results like this are beginning to suggest they can, they will prevent us getting a majority."
A winner-takes-all constituency voting system makes it hard for small parties to win seats in the London parliament.
Eastleigh does not directly reflect national sentiment, with a YouGov poll in the Sun on Friday putting the opposition Labour party on 42 percent, the Conservatives on 29 percent, the Liberal Democrats on 12 percent and UKIP on 11 percent.
But deep austerity measures combined with an ailing economy heading for its third recession in four years have drained backing for Cameron, who formed a coalition government with the Liberal Democrats in 2010.
Last week's decision by Moody's to strip Britain of its coveted top-notch triple-A rating was an embarrassment and again raised questions about his leadership which some Conservative MPs have begun to openly question.
Farage's party has siphoned off support from traditional Conservatives by attacking EU bureaucracy and immigration from eastern Europe, tapping into what he says is a widespread feeling voters' concerns have been ignored.
Under pressure from UKIP, Cameron has promised to hold an in-out referendum on Britain's membership of the EU by the end of 2017 if he wins the next election, a move his supporters had hoped would steal UKIP's thunder.
Commentators said the election would help stabilize the coalition in the short term, as Clegg's leadership of the Liberal Democrats, without whom the rightist Conservatives cannot govern or pass legislation, had faced intense pressure.
Irene Cook, 66, a retired shop assistant who voted UKIP, said the party's policies on immigration had attracted her.
"We wanted Britain to stay Britain. We didn't want any more immigration of other people coming in from other countries. It's got to stop. We're only a small island anyway.
"We voted for them, and I'm very, very pleased, they've done very well."
(Writing by Michael Holden and Andrew Osborn; Editing by Guy Faulconbridge and Andrew Roche)
(c) Copyright Thomson Reuters 2013. Check for restrictions at: http://about.reuters.com/fulllegal.asp