The morning after the UK’s Brexit referendum, in which Britain voted to leave the European Union, Prime Minister David Cameron tendered his resignation. "I fought this campaign in the only way I know how, which is to say directly and passionately what I think and feel," Cameron said in an emotional speech. The resignation won’t take effect immediately, but it’s clear that Cameron’s time in office has come to an end.

Cameron did fight hard against Brexit, as he said. But you’d be forgiven for not knowing, based on his resignation speech, that he was the entire reason Brexit happened in the first place.

Brexit was his fault. And that, barring a last-minute miracle, will be his shame forever.

A brief history of Tory Euroskepticism

To understand why Cameron decided to hold a referendum even though he opposed it, you need to understand a little about the Conservative Party’s fraught history with the EU.

Cameron’s Conservative Party has been at odds with itself over Europe since the 1980s, largely due to Margaret Thatcher, who was prime minister of the UK from 1979 to 1990. Prior to Thatcher, the Tories (as members of the Conservative Party are often called) had been the more Euro-positive of the UK’s two major parties. Conservatives saw greater European unity as a way to strengthen the UK’s political influence vis-à-vis the rest of Europe, while most skepticism came from the Labour Party’s left flank (which saw the move toward supranationalism as an international capitalist effort to weaken the welfare state).

Thatcher, however, scrambled these battle lines when she came to power, criticizing Europe’s drive to unity as exactly the kind of big-government initiative she so famously opposed at home.

"We have not successfully rolled back the frontiers of the state in Britain, only to see them re-imposed at a European level, with a European super-state exercising a new dominance from Brussels," Thatcher said in a famous 1988 speech in Bruges.

Thatcher’s arguments were unpopular with many in her Conservative Party, contributing to an uprising that ended her premiership in 1990. But her arguments set the tone for the Tory right wing, which would increasingly come to see the European project as a threat to UK sovereignty and national identity. Even though a Conservative prime minister, John Major, brought Britain into the EU in 1993, he did so while facing stiff resistance from his own party, making it difficult to press his own agenda.

After 1993, the EU grew in power. Britain began to feel the effects, with mass migration from Europe spiking after the EU admitted several post-communist countries in 2004. Citizens from these poorer countries wanted to move to the UK for work, and EU rules prevented the historically closed-off UK from stopping them.

The EU’s growth in power and EU migration empowered Tory Euroskeptics, creating an environment inside the party that was fairly hostile to the EU. This is the environment that David Cameron faced in 2005, when he ran for the leadership of the Conservative Party. Cameron’s approach was to placate the Euroskeptics rather than challenge them — and it worked.

"As more European treaties, from Amsterdam to Lisbon, brought ever deeper integration, Tory Eurosceptics began to talk openly of EU exit," the Observer’s Toby Helm writes. When he announced his run for leadership, Cameron promised to withdraw from the Conservatives from the European People's Party, a Europe-wide umbrella organization for center-right parties. It was "a signal of intent," says Helm, that Cameron would take the Euroskeptics' side when in office.

Cameron’s 2005 pandering, which he repeated several times before his ascension to the premiership in 2010, illustrated Cameron’s approach to the Euroskeptics: appease them. Whether out of partial agreement or crass political calculation, Cameron concluded that courting Euroskeptics, rather than confronting them, was the best way for him to gain and hold on to power.

He may have been right. But it set the stage for the disaster that will likely define his time in office.

Cameron proposed Brexit to save his own political skin — but ended up destroying it and screwing over the country

After winning the 2010 UK elections, Cameron initially tried to move his party away from divisive fights over Europe. He wanted the Tories to stop "banging on about Europe," as Cameron once famously put it.

"The EU, he recognized, was a distraction from more immediate and pressing concerns," Scottish journalist Alex Massie writes in Foreign Policy. "Besides, Cameron appreciated that Tory divisions over Europe helped bring about Margaret Thatcher’s demise and crippled John Major’s premiership."

But as his term went on, Cameron’s political situation started to become more tenuous. His austerity policies choked off Britain’s recovery, leading to a slowdown in growth between 2011 and 2012 that helped tank his poll numbers. The ongoing eurozone crisis amplified Tory critiques of Europe, and continued EU immigration fueled the rise of the anti-EU, anti-immigrant UK Independence Party (UKIP).

Intensifying right-wing Euroskepticism was feeding off current events, fomenting a movement that threatened to swallow Cameron’s political career whole.

In May 2012, Cameron convened a meeting of his advisers — at, of all places, a pizza joint in Chicago’s O’Hare Airport. They decided to run a play straight out of Cameron’s 2005 playbook: throw a rhetorical bone to the Euroskeptics without actually trying to alter Britain’s relationship to the EU. That meant a referendum on Europe.

In June 2012, Cameron floated the idea of a referendum on renegotiating Britain’s relationship with the EU. This wasn’t a full Brexit, just a vote on whether the EU should try to negotiate a different deal for its membership. But it was a major sop to the Euroskeptics, one that alarmed members of Britain’s political establishment.

In private, Cameron told a political ally, Liberal Democrat leader Nick Clegg, that this was a necessary move to stop the right, not an act of conviction.

"I have to do this. It is a party management issue. I am under a lot of pressure on this. I need to recalibrate," Cameron said, per the Guardian’s Martin Kettle. "My backbenchers are unbelievably Euroskeptic and UKIP are breathing down my neck."

Bear in mind that Cameron faced no formal rebellion here — at least not yet. He put Britain’s role in Europe in jeopardy in order to stave off an as-yet hypothetical challenge to his own political career.

Yet Cameron had fallen to the classic appeasement trap. He assumed that a moderate step would satisfy the Euroskeptics, when in reality they wouldn’t stop until a full Brexit referendum was held. "From that moment the issue became when, not whether, Cameron would pledge a referendum as Tory policy," Kettle writes.

In January 2013, Cameron formally committed to holding a Brexit referendum if the Tories won a full majority in the 2015 elections. Cameron did not expect to have to follow through on this — most UK political observers believed the Tories would either lose or, at most, win a plurality of seats in Parliament.

But Cameron underestimated himself, or overestimated his Labour opponent. The Tories defied the polls and won a shocking majority.

Now Cameron was stuck: He either had to act on his promise or face a rebellion for real. So in February 2016, he announced that the UK would be holding a referendum on Brexit — but also that he would oppose the UK departing the EU.

Polls were once again his comfort, showing a 10-point lead for the "Remain" campaign. Cameron was confident he’d win.

He was wrong — terribly wrong. The "Leave" campaign won. Cameron’s quest to strengthen his own right flank had turned into a world-historical disaster.

"This is a shipwreck and Cameron is the captain who drove HMS Britain onto the rocks," Massie writes. "That is his legacy; that is what he will be remembered for. And deservedly so."