LONDON — Lawmakers from British Prime Minister Theresa May's party will vote on whether to remove her from power Wednesday.

The vote of no-confidence in her leadership comes amid the widening chaos over the manner of the U.K.’s divorce from the European Union. If May loses, she will have to step down as prime minister.

It was triggered when at least 48 Conservative colleagues wrote letters demanding a vote.

May would be toppled if 158 of her party's 315 lawmakers don't support her in a secret ballot set to take place after 1 p.m. ET on Wednesday.

But if she wins, she can’t be challenged again for a year.

“I will contest that vote with everything I’ve got,” May said outside the prime minister’s official residence on Wednesday morning.

May added that she had postponed a trip to the Irish capital of Dublin to try to convince colleagues that she is still the best person to steer the U.K. through the uncertainty of leaving the E.U.

The attempt to oust her came as lawmakers tried to decide what the relationship between the U.K. and the E.U. will look like after Britain leaves the 28-member bloc on March 29.

The prime minister has negotiated her own deal with the E.U. but most British lawmakers hate it.

Lawmakers who are hardline Brexit supporters in May's own party have accused her of selling out to the E.U. in negotiations.

A separate parliamentary vote on May's agreement that was scheduled for Tuesday was pulled because she appeared certain to be defeated with as many as 100 of her party lawmakers openly opposing her plan.

But many of those same politicians would be reluctant to depose May altogether, fearing further chaos or even the prospect of the opposition Labour Party gaining power.

According to the BBC, by 8 a.m. ET at least 158 Conservative colleagues had publicly stated they'd support May in the looming vote of no-confidence. While that would be enough for her to remain in power, the ballot will be secret and it's not certain that every politician will vote as they've stated.

It isn’t only May’s leadership that is up in the air — it is how the U.K. exits the E.U., and whether it retains a close relationship with the bloc, leaves with more independence or crashes out without agreeing a deal.

Chief among the concerns in Parliament is what Brexit means for the border between Northern Ireland, which is part of the U.K., and the Irish Republic, which is a separate country and will remain part of the E.U.

Until a 1998 peace deal, the border was a front line in a bloody 30-year conflict known as "The Troubles." Today it is all but invisible, and some fear that the reinstatement of a physical boundary would rekindle tensions and even spill over into violence.

But supporters of Brexit say May's deal fails to deliver on the clean break with the bloc that they want.

Pro-Brexit lawmakers Jacob Rees-Mogg and Steve Baker said in a joint statement that "in the national interest, she must go."

If May is ousted in on Wednesday, there will be a leadership contest within her ruling Conservatives to decide on her replacement. If several candidates come forward, Conservative lawmakers will vote to whittle down the field to two options. The finalists will then be put to a postal ballot of the wider Conservative Party membership. May's replacement will become prime minister, but a general election will not automatically be triggered.

Tory Brexiter rebels may have inadvertently done @theresa_may a favour. If she wins no-confidence vote by more than two-thirds, she emerges stronger than she is today and even her hated Brexit plan is reborn to fight another day. https://t.co/XYlccbkrrq — Robert Peston (@Peston) December 12, 2018

But if the vote against her is much more than a third of her MPs, she struggles to survive. Even though she says she will stay if 157 Tories vote against her (ie one vote less than a majority) she may feel obliged to quit if 130 or so of her MPs show themselves against her — Robert Peston (@Peston) December 12, 2018

Some Cabinet colleagues rallied to May's support. Home Secretary Sajid Javid tweeted that a leadership contest, with Brexit little more than three months away, "will be seen as self-indulgent and wrong."

May took over as leader of the Conservatives — and the country — in July 2016 when David Cameron stepped down in the wake of the Brexit referendum. Cameron had called the vote in an effort to resolve the issue of the U.K.'s relationship with the E.U. — something that has divided the Conservatives for decades.

At the time May pledged to honor the referendum result.

A smiling May gleefully traded jibes with Jeremy Corbyn, the leader of the Labour Party, in Parliament on Wednesday.

Challenging her effectiveness as prime minister, Corbyn called May’s handling of Brexit “appalling,” and accused her party of damaging the country and its democratic foundations.

May retorted that the “biggest threat isn’t leaving the E.U, it is a Corbyn government,” repeating the claim that Labour's leadership is dangerously left-wing.

While leading Corbyn in the polls, May and her Conservatives are still vulnerable. Seeking to consolidate her position, May called an election in June 2017. But instead of strengthening her party's position, the Conservatives lost a slew of seats to Labour.

Tim Bale, a politics professor at Queen Mary, University of London, said that while May appeared to be on the ropes it was still too soon to write her off.

“Will she win? Possibly,” he said. “No one else in most people’s view is able to extract a quote-unquote better deal out of the E.U.”

And even if May loses her job as party leader and thus stops being prime minister, whoever replaces her will be "tainted with the problem of Brexit," Bale added.