Negotiating Brexit was never going to be easy.

Any prime minister would have faced a nearly impossible task: Turn a highly controversial and impossibly vague two-sentence referendum into a detailed plan that would appeal to European leaders, who find the whole idea of a split abhorrent, and to British politicians with all kinds of conflicting agendas and goals.

Add to the mix the challenge of disentangling Britain’s economy from the rest of Europe, a testy and potentially volatile border situation in Ireland, and the millions of Brits living in Europe who’ve come to rely on freedom of movement, and you’ve got, well, a huge, unpopular mess.

That’s certainly how people are describing the accord that British Prime Minister Theresa May put together over the last two years. Her 585-page plan, presented to Parliament last month, is so unpopular that a vote on it had to be postponed because it wouldn’t have passed. A non-trivial number of people in her own party supported a no-confidence vote against May this week.

Many hard-line Brexiteers have blamed May for the mess, accusing her of negotiating a garbage deal because she’s a garbage negotiator.

Many experts, though, say she’s not really to blame.

Nicholas Burns, a former top-level State Department official and Harvard Kennedy School professor, has led his share of international negotiations. He’s not sure May could have come up with a better plan.

“She’s been given an impossible task by the Brexiteers,” he said. “The negotiating goals of the E.U. are entirely opposite from Britain’s.” And there’s very little reason, he added, for the E.U. to make any concessions. “They wanted to make this so tough a deal that no other E.U. country would even think about leaving,” he said.

The process has gone worse than other tough deals — even politically tricky and controversial ones like the Iran nuclear accord — because of the very setup.

“Normally in a negotiation you don’t really start unless you feel there’s a reasonable chance of success,” Burns said. “I think one has to feel sympathy for May. She was given a mandate beyond her control and did not have any leverage on her side.”

Jason Langrish, executive director of the Canada Europe Roundtable for Business, who has helped negotiate trade accords with Europe, agreed that May had few good options going in.

“Brexit is a mess and always was going to be one,” he wrote in an email, saying May’s final product was “reasonable.”

But, he said, May did face particular challenges and make a couple of blunders.

To start, Langrish argued, Britain lacked the dealmaking capacity and expertise of the European Union team. In the last two decades, Britain has left much of that work to Brussels, which meant it didn’t have a team of seasoned experts ready to swoop in.

In addition, he said, May triggered Article 50 — the portion of the Treaty of Lisbon accord that gives nations the option of unilaterally pulling out of the E.U. — without first building a consensus around what the British negotiating position would be. That’s a problem, because triggering Article 50 sets a deadline.

“They have since wasted a lot of time and energy during the two-year period and seem no closer to a unified position,” he wrote.

May also laid out several “red lines” in her January 2017 Lancaster House speech on her vision for Brexit, like a free-trade agreement with Europe with all the perks of the single market but none of the downsides, that were tough sells from the start.

By framing the conversation that way, May raised expectations, leading to disappointment when she had to backtrack. May also, Langrish wrote, “never seemed to grasp that the UK was in a far weaker negotiating position than the EU due to the relative sizes of their economies.”

And she made the strategic error of triggering an election to try to grow her conservative majority, only to lose seats, forcing her to come up with a compromise on one of the hardest Brexit issues, Ireland. Of course, May couldn’t have known how the election would turn out. But her “lousy campaigning” Langrish wrote, didn’t help matters.

Read more:

Brexit: ‘The word you’re looking for is shambolic’

Britain’s Brexit crisis was entirely self-inflicted

Theresa May comes up empty in Brussels, with no new Brexit concessions