LONDON — Prime Minister Theresa May survived a humiliating challenge to her leadership Wednesday night, beating back a no-confidence vote triggered by rebels in her Conservative Party who oppose her compromise deal on how to leave the European Union.

May won the party-only vote by 200 to 117 — comfortably surpassing the simple majority of 159 votes she needed to hold on to power. But it was hardly a victory.

The public brawling and parliamentary challenge by her fellow Tories leaves May a wounded leader. The British prime minister is now immune to a leadership challenge by her party for a year, but she faces lawmakers hostile to her Brexit deal, which remains broadly unpopular.

In Brussels, May’s survival offered measured relief to E.U. leaders, who have little option other than hoping she can hold on and get the Brexit deal approved by Parliament before the March 29 exit date.

But many countries have sped up emergency preparations, fearing that Britain’s political paralysis will lead it to crash out of the E.U. without a deal.

“Glad about the outcome of tonight’s vote,” the Austrian Chancellor Sebastian Kurz wrote on Twitter. “Our shared goal is to avoid a no-deal scenario.”

A no-deal Brexit could result in chaos at ports, a freeze in trade, empty grocery store shelves, grounded aircraft and the threat of recession, economists have warned.

Guy Verhofstadt, a Belgian politician and Brexit coordinator for the European Parliament, tweeted, “Even in the Tory party, there is no majority for no deal or hard Brexit.”

Shortly after the vote that saved her job, May said, “This has been a long and challenging day. But, at the end of it, I’m pleased to have received the backing of my colleagues in tonight’s ballot.”

May declared she had a “renewed mission — delivering the Brexit people voted for, bringing the country back together and building a country that really works for everyone.”

She had earlier warned rebellious lawmakers that ousting her would not make getting a better Brexit deal any easier and would instead bring delay and confusion.

In an 11th-hour meeting with her backbench, apparently to win further support, May told Tory members that she would not stand for election before the public again.

George Freeman, a Conservative member of Parliament, spoke of a “powerful and moving moment” as May told her fellow Tories that she has “listened, heard and respects the will of the party” and that once she delivers Brexit “she will step aside for the election of a new leader to lead the reunification and renewal we need.” Delivering Brexit, however, could take months or, more likely, years.

May and her Brexit plan have been pummeled for weeks by members of Parliament, from her own party and the opposition. Hard-line Brexiteers want a cleaner break from the E.U., while remainers worry about the economic and other costs of what May has proposed.

But faced with the prospect of losing their leader in a no-confidence vote, a long string of top Tories publicly declared their support for May — previewing that the prime minister would survive the day.

Philip Hammond, the chancellor of the exchequer, called the Tory rebels who pressed for the vote “extremists.” He tweeted: “The Prime Minister has worked hard in the National interest since the day she took office and will have my full support in the vote tonight. Her deal means we leave the EU on time, whilst protecting our jobs and our businesses.”

Conservative lawmaker Geoffrey Cox tweeted before the vote that he would be backing May, adding: “This is no time for the self indulgent spasm of a leadership election.”

May triggered the ire of lawmakers when she announced Monday that she was delaying a parliamentary vote on her Brexit deal, after concluding it would have faced a devastating defeat in the House of Commons. 

She spent Tuesday meeting with Netherlands Prime Minister Mark Rutte, German Chancellor Angela Merkel and E.U. leaders, trying to concoct new concessions that might appease British lawmakers. But the Europeans have been uniformly opposed to any substantive and binding changes to what the two sides have negotiated.

For the Tories to challenge May, ostensibly their party leader, they needed to send at least 48 letters — equaling 15 percent of the 317 Conservative lawmakers — to Graham Brady, the chairman of the 1922 Committee, a panel made up of all Conservative backbenchers in Parliament.

Brady told the BBC that he informed the prime minister on Tuesday night that the threshold of 48 letters had been reached.

Party members voted by secret ballot Wednesday evening, so it was not until Brady’s 9 p.m. announcement to a roomful of reporters in the ornate Committee Room 14 that it was clear May would continue on.

Amber Rudd, a top Tory leader, called the vote a “strong result” for May. “Now we can get on with the important work ahead,” Rudd said.

But the result did little to quiet May’s critics.

“Tonight’s vote makes no difference to the lives of our people,” opposition Labour Party leader Jeremy Corbyn said in written a statement. “The Prime Minister has lost her majority in Parliament, her government is in chaos and she is unable to deliver a Brexit deal that works for the country and puts jobs and the economy first.”

Jacob Rees-Mogg, a Conservative member of Parliament and an arch-Brexiteer, called the vote “a terrible result” for May. Although it did not force May’s ouster, Rees-Mogg said that it was enough to show how little confidence her party had in her and that she should do the honorable thing and resign.

Commentators drew comparisons to Margaret Thatcher, Britain’s only other female prime minister, who won a confidence vote but resigned anyway in 1990.

The leader of Scotland, First Minister Nicola Sturgeon, expressed frustration with the political squabbling. She tweeted: “Today is a stark reminder that the UK is facing chaos and crisis entirely because of a vicious civil war within the Tory party. What a self-centered bunch they are. They all need to go, not just the PM.”

Tim Bale, a professor of politics at Queen Mary University of London, said May’s survival will hardly solve the Conservative Party’s Brexit problems. “Is the problem actually the prime minister? The problem is what it has always been. Any deal that could pass muster with the E.U. won’t pass muster with Tory Euroskeptics.”

In Brussels, where preparations are underway for a summit of European leaders Thursday and Friday for which Brexit is only one among many issues, diplomats were measured in their reaction to the British drama. Many have long braced for a challenge to May’s leadership, and although the British instability added to uncertainty surrounding the Brexit deal, several diplomats said there was little they could do to sway events in London.

If anything, the leadership challenge hardened resolve among the remaining E.U. nations to insist on an ironclad backup plan to preserve a border-free frontier between the Republic of Ireland and Northern Ireland. Diplomats increasingly doubt that they can rely on assurances from any British leader, because that leader can quickly be replaced.

Britain’s crashing out of the E.U. with no deal could also lead to the imposition of border controls between the Republic of Ireland and Northern Ireland, meaning that the E.U. and Britain both have motivation to resolve the issue.

“We do not have any intention of further changing the withdrawal agreement,” Merkel told the German parliament on Wednesday. “That is the common position of the 27 member states.” 

Birnbaum reported from Brussels. Quentin Ariès in Brussels contributed to this report.