Britain’s Conservative Party suffered crushing defeats in the race for what had previously been two safe seats in Parliament, but narrowly avoided losing a third contest, in election results Friday that sent an ominous signal about the political future of Prime Minister Rishi Sunak.
The main opposition Labour Party won its biggest by-election victory since 1945 in Selby and Ainsty, in Yorkshire in the north of England — a dramatic shift in fortunes and a worrisome defeat for the Tories in a region that had undergirded their sweeping national victory three years ago.
The centrist Liberal Democrats scored a thumping win in another former Conservative stronghold, Somerton and Frome, in England’s southwest, revealing further cracks in what had long been a heartland of Tory voters.
But the Conservatives avoided a sweep by narrowly holding on to Uxbridge and South Ruislip, in the northwestern fringes of London, a district that had been represented by the former prime minister, Boris Johnson.
For Mr. Sunak, who has been weighed down by a cost-of-living crisis and scandals involving Mr. Johnson and other Tories, the victory in Uxbridge was likely an outlier — driven by an unpopular plan by London’s Labour mayor, Sadiq Khan, to extend a costly low-emission zone to encompass the district.
The other two races, analysts said, are a better gauge of Britain’s anti-incumbent mood after 13 years of Conservative rule and provided a possible preview of the general election that Mr. Sunak must call by January 2025.
Voters in reliably Tory bastions of Britain’s north and south came out strongly against the Conservatives, suggesting that unless there is a significant change in the political landscape in the coming months, the Tories are on track to lose to Labour in the next national election.
“No matter how much they try to make it all about Uxbridge, Conservative M.P.’s will know in their heart of hearts that this was a very bad night for their party,” said Tim Bale, a professor of politics at Queen Mary University of London.
The success of Labour in one district and the Liberal Democrats in another, he said, suggested that people were voting tactically to increase the odds of defeating the Conservatives.
“Voters are pretty clued-up now as to which opposition party to support if they want to get rid of the government next year,” Professor Bale said.
By-elections occur when a seat in the House of Commons becomes vacant between general elections. These races were triggered by the departure of Mr. Johnson, who was rebuked by his peers for misleading them over his attendance at lockdown-breaking parties; Nigel Adams, a close ally of Mr. Johnson’s in Selby and Ainsty; and David Warburton of Somerton and Frome, who admitted to using cocaine.
The voting took place Thursday, and results were counted through the night and into early Friday morning.
For Labour, the victory in Selby and Ainsty was one of its most striking in decades: The party’s candidate, Keir Mather, overturned the largest Conservative majority in a by-election since 1945 with a huge swing in the vote. At 25, Mr. Mather will become the youngest member of the House of Commons.
“This is a historic result that shows that people are looking at Labour and seeing a changed party that is focused entirely on the priorities of working people with an ambitious, practical plan to deliver,” the Labour leader, Keir Starmer, said.
For the Liberal Democrats, the victory in Somerton and Frome was numerically even more impressive: Sarah Dyke, a Somerset counselor, overturned a Tory majority of more than 19,000 to win the seat by 11,008 votes.
In Uxbridge, there was a small swing in the vote from the Conservatives to Labour. But the Tory candidate, Steve Tuckwell, won by a razor-thin margin of fewer than 495 votes, which spared Mr. Sunak the distinction of being the first prime minister since 1968 to lose three by-elections in a single day.
In his victory speech, Mr. Tuckwell attributed the result to the “damaging and costly” plan by Mr. Khan, London’s mayor, to extend an ultralow emission zone across all of London’s boroughs, including Uxbridge. Mr. Tuckwell campaigned against the plan, which is unpopular among people who own older cars.
While the race in Uxbridge proved the maxim that all politics is local, the opposition victories in Yorkshire and southwest England suggested that the broad trends in British politics are still moving firmly against Conservatives. In national polls, Labour leads the Conservatives by close to 20 percentage points, while Mr. Sunak’s approval ratings have dropped to the lowest level of his time in office.
With Britain besieged by persistent high inflation, a stagnating economy and widespread labor unrest, the Conservatives face a real threat of being thrown out of power for the first time in 14 years.
While Britain shares some of its economic woes with other countries in the wake of the pandemic and Russia’s invasion of Ukraine, the Conservatives amplified the problems through policy missteps and political turmoil that peaked in the brief, stormy tenure of Mr. Sunak’s predecessor, Liz Truss.
She proposed sweeping but unfunded tax cuts that alarmed the financial markets and triggered her own downfall after on 44 days in office. Mr. Sunak shelved Ms. Truss’s trickle-down agenda and restored Britain’s fiscal stability. But her legacy has been a poisoned chalice for Mr. Sunak and his fellow Tories with much of the British electorate.
“The Liz Truss episode really dented their reputation for economic competence, and that will be very hard to win back,” Professor Bale said.
Recent British elections have featured talk of a grand political realignment, with candidates emphasizing values and cultural issues. But analysts said these elections were dominated by the cost-of-living crisis, kitchen-table concerns that hurt the Conservatives after more than a decade in power.
In winning in Selby and Ainsty, Labour hopes to show that it has regained the trust of voters in the north and middle of England — the so-called “red wall,” where it once dominated but lost to the Conservatives in 2019.
Somerton and Frome was a test of the Tories’ hold on their southern heartland, known as the “blue wall.” They have been under pressure from a revival of the Liberal Democrats, who have benefited from voters casting their ballots strategically for whoever seems best placed to defeat the Tory candidate, as Mr. Bale suggested.
This time around, the contests were also a reminder of the toxic legacy of Mr. Johnson. His resignation from Parliament last month prompted the departure of his ally Mr. Adams, who quit after not being given a seat in the House of Lords, as he had expected.
Mr. Warburton’s problems were his own, but they reminded voters of a cloud of scandal that has wreathed the Conservatives for the last few years. Other Tory lawmakers have been caught up in allegations of sexual misconduct, financial impropriety and improper lobbying of the government.
“This is probably the closing of a chapter of the story of Boris Johnson’s impact on British politics,” said Robert Hayward, a polling expert who also serves as a Conservative member of the House of Lords. But he added, “Whether it’s the closing of the whole book is another matter.”