LONDON — Britain's most senior official in charge of negotiating the country's exit from the European Union resigned Sunday, accusing Prime Minister Theresa May of undermining Brexit with her plan to keep close trade ties with the bloc.

Brexit Secretary David Davis quit just two days after May announced she had finally united her quarrelsome government behind a plan for a divorce deal with the EU.

In a blow to the beleaguered prime minister, Davis told May in a letter that the government's proposals for close trade and customs ties "will leave us in at best a weak negotiating position, and possibly an inescapable one."

Davis's late-night resignation undermined May's already fragile government, which has lost several ministers in the past year over sexual misconduct allegations and other scandals. Davis was a strong pro-Brexit voice in a Cabinet divided between supporters of a clean break with the bloc and those who want to keep close ties with Britain's biggest trading partner.

May's office said a replacement for Davis would be announced Monday.

His departure could embolden Brexit-supporting Conservative lawmakers — who have long considered May too prone to compromise with the EU — to challenge her leadership.

The staunchly pro-Brexit Conservative lawmaker Andrea Jenkyns tweeted: "Fantastic news. Well done David Davis for having the principal and guts to resign."

Jenkyns said Steve Baker, a junior minister in the Brexit department, had also quit. There was no immediate comment from Baker.

Less than nine months remain until Britain leaves the bloc on March 29, 2019, and the EU has warned Britain repeatedly that time is running out to seal a divorce deal.

On Friday, Davis and the rest of May's fractious Cabinet finally agreed on a plan for future trade ties with the EU.

May is due to brief lawmakers Monday on the plan hammered out during a 12-hour meeting at Chequers, the prime minister's country retreat. It seeks to keep the U.K. and the EU in a free-trade zone for goods, and commits Britain to maintaining the same rules as the bloc for goods and agricultural products.

Some Brexit-supporting lawmakers are angry at the proposals, saying they will keep Britain tethered to the bloc and unable to change its rules to strike new trade deals around the world.

In his resignation letter, Davis said the "'common rule book' policy hands control of large swathes of our economy to the EU and is certainly not returning control of our laws in any real sense."

He said he was worried the government's negotiating approach would "lead to further demands for concessions" from Brussels.

"It seems to me that the national interest requires a secretary of state in my department that is an enthusiastic believer in your approach, and not merely a reluctant conscript," he wrote.

In a letter to Davis, May disagreed with his characterization of her plans, saying the deal she seeks "will undoubtedly mean the returning of powers from Brussels to the United Kingdom."

Conservative lawmaker Jacob Rees-Mogg, a leader of the party's "hard Brexit" faction, compared May's plan to an egg so softly boiled that it "isn't boiled at all."

"A very soft Brexit means that we haven't left, we are simply a rule-taker," he said.

Some Brexiteers dream of replacing May with a staunch Brexiteer, such as Foreign Secretary Boris Johnson, who in the past has disagreed publicly with his boss.

Johnson has not commented publicly since Friday. But some senior pro-Brexit ministers have backed May's plan. Environment Secretary Michael Gove said Sunday that it did not contain everything he wanted but "I'm a realist."

"All those of us who believe that we want to execute a proper Brexit, and one that is the best deal for Britain, have an opportunity now to get behind the prime minister in order to negotiate that deal," he told the BBC.