LONDON -- Prime Minister David Cameron's Conservatives took a harsh pummeling on Friday after results of a by-election showed surging support for the right-wing United Kingdom Independence Party.
Such deep inroads into the Conservative vote, if sustained at a general election in two years' time, could oust the Conservatives from power and usher the Labour Party back into 10 Downing Street.
Midterm by-elections in Britain have been notoriously quirky for decades, providing opportunities for protest voting that have often been uncertain predictors of general election outcomes. But in this case, with the results tracking closely with national polls and with mounting concern within the Conservative Party itself about its election prospects, the vote was widely read as a measure of deep problems for the Conservatives.
Senior figures in Mr. Cameron's party acknowledged privately that the results from Thursday's vote in Eastleigh, a mainly suburban voting district near the coastal city of Southampton, had thrown the deeply divided Conservatives into further disarray.
But Mr. Cameron was quick to assert that the results were quixotic and not a death knell for the party's prospects in 2015. "It's a protest," Mr. Cameron said after the Eastleigh results showed the Independence Party taking 28 percent of the vote, pushing the Conservatives, with 25 percent, into third place. "That's what happens in by-elections."
The winners, with 32 percent of the vote, were the Liberal Democrats, a left-of-center party that has been in an increasingly fractious governing coalition with the Conservatives since the general election in 2010.
Observers attributed the Independence Party's surge -- its best result in a parliamentary by-election -- to its relentless campaigning on two issues that have a powerful resonance among right-of-center voters: high levels of immigration and Britain's membership in the 27-nation European Union. European directives on a wide range of social, economic and judicial issues have been a persistent source of discontent among British voters generally and a cause of longstanding strife among Conservatives. Mr. Cameron, whose leadership has been widely questioned among a powerful bloc of mainly right-wing Conservative legislators, said he would not change the policies that have led to discontent with him and suggestions that the party seek a new leader before the 2015 general election.
Among those policies are Mr. Cameron's decision to support a same-sex marriage bill that is now moving through Parliament and to seek to renegotiate the terms of Britain's membership in the European Union rather than quit it altogether, as the Independence Party and many right-wing Conservatives advocate.
Some of his critics say that in seeking to placate his Liberal Democrat partners and hold the coalition together by adopting policies taken from the Liberal Democrat playbook, notably on same-sex marriage, Mr. Cameron has abandoned core Conservative beliefs.
"It's disappointing for Conservatives," Mr. Cameron said, referring to the Eastleigh vote. "But we will remain true to our principles, true to our course in a way that can bring back" the sort of Conservative voters who defected.
One of the most powerful Conservatives in the Cameron cabinet, Education Minister Michael Gove, compared Mr. Cameron's mood to that of Margaret Thatcher, the Conservative prime minister in the 1980s, who met an incipient revolt among Conservative backbenchers -- centrists who had rejected some of her policies -- by saying, "The lady's not for turning."
"There were times when Margaret Thatcher was challenged by by-election results in the 1980s, but she stuck to her course," Mr. Gove said.
The next general election, expected to be a tight contest, has become a magnetizing force in British politics in recent months, with all parties fine-tuning their policies in accordance with shifting opinion polls. The Conservatives have been running up to 12 percentage points behind Labour in recent national polls, a gap that has not been insurmountable for some governing parties in the past.
But their uphill battle to retain the power they won in 2010, after 13 years in opposition, could founder if the Independence Party's surge continues and turns the election into a four-cornered battle. While the Independence Party, hitherto seen as a mainly marginal protest group, drew support from all three major parties in the Eastleigh vote, early analyses of the voting suggested that it inflicted most damage on the Conservatives.
Nigel Farage, the Independence Party's leader, described the voting results as a watershed moment, particularly as it came from a southern, heavily middle-class constituency, or voting district, that has not seen the influx of immigrants that helped bolster the Independence vote in other recent electoral contests, particularly in rundown industrial centers where competition for jobs and housing is fierce. In Britain's last round of by-elections, in November, the Independence Party came in second to Labour in the northern city of Rotherham, with 22 percent of the vote.
"We have really connected with voters in this constituency," Mr. Farage told the BBC. "And that is because we are talking about issues that other parties would like to brush under the carpet."
The Eastleigh result took on a particularly ominous cast for the Conservatives -- the party has never won a general election outright without winning Eastleigh since the constituency was established in 1955.
For the Liberal Democrats, the narrow win in Eastleigh was tinged with its own element of foreboding. The same was true, to some extent for Labour, which took less than 10 percent of the vote, though Labour spokesmen said the party did not expect to win the seat and did not need to win it to gain a majority in 2015.
The Liberal Democrats got 46 percent of the vote in Eastleigh in 2010, and the 14 percentage point drop, a collapse that closely matched the slump in the Conservative vote share, was seen by some commentators as a harbinger of disaster for the Liberal Democrats in 2015 if many of the party's supporters defect to punish the leadership for compromising with the Conservatives on the government's harsh austerity program and cutbacks in welfare and education, including a tripling of university fees.
But other Liberal Democrats saw the victory as a testament to the loyalty of their core voters at a time when the party has been hit by scandal.
The by-election was called to fill the seat left vacant by Chris Huhne, a former energy minister who resigned from Parliament last month after pleading guilty to obstruction of justice for persuading his wife to take responsibility for a 2003 speeding ticket that he incurred, to avoid losing his license. And the party's former chairman, Chris Rennard, has been making unwanted headlines amid allegations of sexual harassment from women in the party, who say their complaints to the party's leader, Nick Clegg, drew no action. Mr. Rennard has denied the allegations.
Mr. Clegg saw the results not as a narrow escape from humiliation, as it was depicted by many commentators, but as a vindication of his decision to lead the Liberal Democrats into the coalition with the Conservatives. He told reporters that the result showed "that we can be a party of government" -- the first time for the Liberals since the 1930s -- "and still win elections."
This article originally appeared in The New York Times.