LONDON — Britain’s Conservative Party on Friday crashed to an election defeat in a district it had represented for more than a century, dealing a second stinging blow to Prime Minister Boris Johnson in a week of political turmoil that has shaken his leadership.
In a contest on Thursday to select a new member of Parliament for North Shropshire, a district near the border with Wales, to the northwest of London, voters abandoned the Conservatives in favor of the centrist Liberal Democrats in one of the biggest voting upsets of recent years.
The victorious Liberal Democrat candidate, Helen Morgan, overturned a majority of almost 23,000 won by the former Conservative lawmaker, Owen Paterson at the last general election, in 2019. Mr. Paterson, a former cabinet minister who had held the seat since 1997, resigned last month after breaking lobbying rules despite an unsuccessful effort by Mr. Johnson to save him.
The defeat follows a rebellion on Tuesday in which around 100 of Mr. Johnson’s own lawmakers refused to support government plans to control the rapid spread of the Omicron coronavirus variant. As well as embarrassing Mr. Johnson, the mutiny forced him to rely on the support of the opposition Labour Party to pass the measures, sapping his authority.
When the results in North Shropshire were announced early Friday, Ms. Morgan had secured 17,957 votes; Neil Shastri-Hurst, the Conservative, had gotten 12,032; and Ben Wood, for Labour, had received 3,686. The votecounting for Thursday’s election took place overnight.
“Tonight the people of North Shropshire have spoken on behalf of the British people,” Ms. Morgan said after her victory. “They have said loudly and clearly, ‘Boris Johnson, the party is over.’”
She added that the voters had decided that Mr. Johnson was “unfit to lead and that they want a change.” She thanked Labour supporters who had given her their votes saying, “Together, we have shown that we can defeat the Conservatives not with deals behind closed doors, but with common sense at the ballot box.”
Although the Liberal Democrats had hoped to pull off a surprise victory, the size of their majority was striking and unexpected. Ed Davey, the leader of the party, described the result as “a watershed moment,” adding in a statement: “Millions of people are fed up with Boris Johnson and his failure to provide leadership throughout the pandemic, and last night, the voters of North Shropshire spoke for all of them.”
Even before the loss of the seat, there was speculation that Mr. Johnson could face a formal challenge to his leadership a little more than two years after he won a landslide general election victory in December 2019.
To initiate a no-confidence vote, 54 of his lawmakers would have to write to Graham Brady, the chairman of the committee that represents Conservative backbenchers. Such letters are confidential but analysts do not believe that prospect is close. Parliament is now in recess giving Mr. Johnson a short political breathing space.
Even so, Friday’s result is likely to increase jitters in Downing Street since North Shropshire was one of the Conservative Party’s safest seats, in an area of Britain that supported Brexit, Mr. Johnson’s defining political project.
Despite their pro-European stance, the Liberal Democrats — who finished well behind Labour in North Shropshire in the 2019 general election — successfully presented themselves as the only credible challengers to the Tories in the constituency.
By doing so they appeared to have persuaded a significant number of Labour’s voters to switch to them in order to defeat the Conservatives. Earlier this year the Liberal Democrats caused another upset when they won another seat from Mr. Johnson’s party in the well-heeled district of Chesham and Amersham, northwest of London.
To some extent, the circumstances of Mr. Paterson’s resignation always made the North Shropshire seat hard to defend for the Conservative Party. But critics say that Mr. Johnson was the main architect of that situation through his unsuccessful efforts to save Mr. Paterson last month.
Since then Mr. Johnson’s standing has been weakened by claims that his staff held Christmas parties in Downing Street last year at a time when they were forbidden under coronavirus restrictions.
The cabinet secretary, Simon Case, is investigating those allegations and his report is expected soon. Mr. Johnson also faces questions about whether he misled his own ethics adviser over what he knew about the source of funding for an expensive makeover of his Downing Street apartment.
In recent weeks Labour has moved ahead of the Conservatives in several opinion surveys which also recorded a drop in Mr. Johnson’s approval ratings. Political analysts said that could put the prime minister in a vulnerable position, given the transactional nature of his party.
“The Tory Party is a ruthless machine for winning elections,” said Jonathan Powell, a former chief of staff to Prime Minister Tony Blair. “If that is continuing into an election cycle, the party will get rid of him quickly.”
But, while the political climate remains volatile, most voters are probably more preoccupied by the impact of the Omicron variant as they prepare for the holiday season.
Mr. Johnson has placed his hopes of political recovery on a speedy roll out of coronavirus booster vaccinations. Earlier this year his fortunes revived when Britain’s initial vaccination effort proved fast and effective, allowing the country to remove all restrictions in July.
Speaking before the North Shropshire result, Matthew Goodwin, a professor of politics at the University of Kent, said that Mr. Johnson could recover but may also be in danger of handing the next election to Labour through his errors.
“I don’t think it’s over for Johnson,” said Professor Goodwin, “I think this is salvageable.” He added: “but Johnson has entered that territory whereby oppositions don’t necessarily win elections because governments end up losing them.”
Mr. Johnson was selected to lead his party in 2019 because of his track record of winning elections and because he promised to ensure that Britain left the European Union.
Now that it has, his position could become vulnerable if he comes to be seen as an electoral liability to the party, Professor Goodwin said, adding that there was a perception among Conservative lawmakers that Mr. Johnson “has no philosophical, intellectual project behind his premiership.”