LONDON — History may not be kind to Theresa May. The departing prime minister had one job to do: deliver Brexit. Yet, as Brits say, she bottled it, repeatedly, and in spectacular fashion. She was unable to deliver on her promise to see Britain leave the European Union, on time, in good order, with a sensible plan for future trade.

The near universal condemnation of her premiership — not only from her rivals and the opposition party but from the Conservative press, party activists and the colleagues who shoved her from office — is as public as it is withering.

“Mrs. May has many virtues, but I’m afraid leadership is not one of them,” said Andrew Mitchell, a Tory grandee.

On Wednesday afternoon, an armored, custom-built Jaguar XJ ferried May to Buckingham Palace to tender her resignation to the queen.

She’s expected to be replaced by Mr. Brexit himself, her former foreign secretary, Boris Johnson, who decried her compromise plan to leave the continental bloc as a humiliation, a surrender, “an absolute stinker.”

“She played a bad hand badly” is about as generous as most of her colleagues will go, on or off the record. Google the words “Theresa May” and “failure,” and the search engine offers more than 20 million results in 0.49 seconds.

Stumbles and setbacks

How did Theresa May not succeed? In so many ways.

As Britain’s second female prime minister, she was hyped by her staff as the 21st century reincarnation of the Iron Lady Margaret Thatcher.

“But it was rather quickly revealed that Theresa May seemed a bit out of her depth,” said Guardian sketch writer John Crace, who coined the descriptor “Maybot” after she gave a particularly robotic interview.

Her deficits became obvious after she called a snap election for June 2017, hoping to solidify her power and strengthen her hand in Brexit negotiations.

Although May was more than 20 points ahead of the opposition going in, she staggered through the campaign. She dodged debates, gave mechanical stump speeches, and, in a gob-smack shocker of a finale, squandered her majority in Parliament. After that, she was constrained in her every move by the need to placate the Democratic Unionists from Northern Ireland propping up her government.

Bitter Brexit struggle

May pledged to “build a better Britain ... a country that works not for a privileged few, but for every one of us.”

But Brexit consumed all. It dominated May’s headlines, debates, diplomacy, agenda.

She started the countdown clock — some say prematurely, before laying the groundwork — by invoking the E.U.’s Article 50 in March 2017. Then, for two years, in secret, relying on a limited circle of trusted aides and civil servants, May negotiated with her European counterparts.

The result was a compromise half-in, half-out 585-page withdrawal agreement.

The Tory backbenches loathed it. The Democratic Unionists hated it. The opposition Labour Party opposed it. Brexiteers said it kept Britain forever shackled to the E.U., in vassalage, as Johnson put it. Remainers complained it would introduce too much economic risk with too little reward.

“She came back from the E.U. with a deal she knew perfectly well she could not get the House of Commons to accept and proceeded to suggest that Parliament was accountable to her rather than the other way round,” said Mitchell, a remainer who served in Prime Minister David Cameron’s cabinet.

“As a result, the U.K. is more divided in every part than ever before,” Mitchell told The Post. “Our international reputation has fallen to an all-time low and the ‘burning injustices’ she vowed to tackle as the center piece of her premiership are sadly all very much in place.”

May saw the support of her disloyal cabinet fall away chair by chair. Johnson resigned in a huff over Brexit in July 2018, heading out the door right behind Brexit Secretary David Davis. The second Brexit secretary, Dominic Raab, would resign in November, complaining to associates that he had been kept out of the loop. In all, 43 cabinet or government ministers quit May’s government, a record.

May also set a record while trying to get Parliament to pass her Brexit deal. She lost the first vote by a historic margin of 432 to 202.

Political theater

As political theater, May’s Brexit drama was a smash hit. Views of “Parliament TV” outpaced popular sitcoms. House of Commons Speaker John Bercow became an improbable celebrity, seal-barking “order! order!” amid the chaos.

Yet, it was almost painful to watch. Once, twice, three times, May’s Brexit plan was gored in House of Commons votes. The prime minister also had to face down a no-confidence motion pushed by Brexiteers within her party and a then, weeks later, one initiated by Labour leader Jeremy Corbyn.

May stuck it out, earning praise for her grit and criticism for her bullheadedness. But she simply couldn’t rally her troops. And she didn’t help her position by lashing out at lawmakers — the very people she needed to back her — and blaming them for the wreckage.

“She could have been a decent PM in normal times, but she simply didn’t have the dynamism to lead a split party and a hung Parliament through this unprecedented challenge,” Ben Bradley, a Conservative lawmaker, told The Post.

May tried to win over Conservatives by suggesting she would step down if they would back her Brexit deal. But as much as her enemies and rivals wanted her gone, the tactic didn’t work.

She turned to Corbyn, hoping to get Labour’s support. But it was too late. They despise each other. Their talks went nowhere.

Finally, May offered a “new Brexit deal” — which included a chance to vote for a second referendum — but it was so disliked, so improbable, she never formally presented it.

“I did everything I could to get it over the line,” May told the Daily Mail in an goodbye interview last week. “I was willing to sit down with Jeremy Corbyn, willing to sacrifice my premiership — give up my job!”

She said, “People have asked me: Why didn’t you tip the table over? But if you do that constantly, it’s like the little girl crying wolf — it ceases to have an effect.”

In her last weeks, as a lame duck, May has tried to muscle through legacy legislation. She’s mostly failed at that, too.

“We’re seeing a big rush to achieve something, anything, but I don’t think there will be much on the ledger when it comes to writing the history books,” said Rosa Prince, author of “Theresa May: The Enigmatic Prime Minister.”

Other high and low points in May’s career

Beyond Brexit, May was excoriated for failing to support survivors following a fire at London’s Grenfell Tower apartment complex that claimed the lives of 72 people.

May was also faulted when a crackdown on illegal immigration, initiated under her tenure as home secretary, made life difficult for the so-called Windrush generation — the Jamaicans and other Commonwealth Caribbean islanders whom the government brought to Britain to help rebuild the country after World War II.

And yet the British public backed her when she confronted Russia over a nerve agent attack in Salisbury. They liked it, too, when she stood up to President Trump, who alternately insulted and patronized her.

“She’s a proud and dignified woman,” Prince said. “I don’t think anyone will question whether a woman can be prime minister again. She did Britain proud on the world stage. Were we embarrassed to have her as our leader? No.”

In a final speech as prime minister on Wednesday, May admitted mistakes but defended her record. She said Parliament rejected her deal three times not because it was a flawed but because “our politics retreated back into its binary pre-referendum positions, a winner takes all approach, to leaving or remaining.” She warned that Britain was seeing “the coarsening of public debate,” which many listeners took as a dig at Johnson and Trump.

By most accounts, May is moral, meticulous and quietly religious. She is also rigid and unimaginative — not great qualities for a negotiator. She is plodding and, according to Brussels diplomats, did not sparkle at dinner over glasses of claret and the pheasant.

In that way, she wasn’t much of a politician.

“It’s surprising, you might say, that she became prime minister,” said Anthony Seldon, a historian who has written books on seven British prime ministers, including a forthcoming one called “May at 10.”

“She would have never stood up to the presidential campaign trail in the States,” he said. “She’s an interior person, she has a busy life of her mind, she’s not an extrovert or exterior person. In many ways she was more like civil servant.”

When she was running for office, asked what was the naughtiest thing she did in her youth, May, a vicar’s daughter, answered that she once ran through a farmer’s field of wheat.

She told the Daily Mail last week, “I have never spent endless amounts of time in the Commons tea room or socialized in the Strangers Bar,” a watering hole at Westminster.

“She didn’t have a great deal of flair,” Prince told The Post. “Who knows, maybe Boris Johnson will achieve a miracle and inspire a whole country, as he does have that capacity — that charisma, that razzle-dazzle. She just doesn’t. She didn’t bring people around behind her. That was probably her great weakness.”

The full measure of May’s leadership will not be apparent until her successor gets his try to solve Brexit.

Will the next prime minister convince Parliament and the country that his way is the best way? Or will Brexit drag on and on? Did May stumble because she faced an impossible task — or because of her inherent shortcomings?

“Was it because this is the deepest, most divisive issue in her party in the last 100 years?” Seldon asked. “Or was it because she lacked the skills?”

Hughes reported from Washington.

This expat teaches cooking in an 18th century farmhouse. Here’s what ‘French Thanksgiving’ looks like in her home.

Cookbook author Kate Hill traveled Europe by barge before settling in southwestern France

‘Hong Kong is my home’: I am protesting on the front line and refuse to back down

Protester Sonia Ng shares her story in her own words

‘For Sama’ is a horrifying account of the Syrian war. It’s also a love letter from mother to daughter.

The documentary is terrifying, devastating and, surprisingly, tender