David Cameron’s decision to hold a referendum was a high-stakes gamble that went badly wrong — dooming both the UK’s membership of the EU and his own career as prime minister.

As Mr Cameron prepares to leave Downing Street in the wake of one of the most stinging defeats a prime minister has endured in recent history, the FT looks at what led to Britain’s historic decision to leave the EU — and how things could have been different.

1. If Mr Cameron had not promised a referendum

The offer of a referendum in 2013 was intended to stop Conservative voters defecting to the anti-EU UK Independence party. But it was not very effective, argue Matthew Goodwin and Caitlin Milazzo, the academics, who point out that three months later Ukip won more than 160 council seats. More importantly, Mr Cameron appeared to have overestimated the Ukip threat — although the party took 3.6m votes in the 2015 general election, it won only one seat. Some suggest that George Osborne, the chancellor who serves as Mr Cameron’s strategist, and even Michael Gove, the pro-Brexit justice secretary, opposed the idea of a referendum. The chancellor has denied the claim.

2. If 16- and 17-year-olds had been enfranchised

In early December the Conservative government defeated by 303 to 253 votes an amendment from opposition parties calling for lowering the voting age for the referendum. That vote overturned backing for the move in the House of Lords. In retrospect the decision may have had an impact on the referendum vote. Teenagers are thought to favour Britain staying in the EU. Mr Cameron thus disenfranchised a group that could have saved his place in history. He did so because youngsters are also more likely to vote for leftwing parties: he did not want to set a precedent that would add to pressure for votes for 16-year-olds in general elections.

A sixteen-year-old Scottish first-time voter in the country's independence referendum © Getty

3. If Angela Merkel had relented on free movement

“I blame Merkel for this,” said Chris Lockwood, a former adviser to Mr Cameron, as the polls turned against Remain 10 days before the vote. In his negotiation, Mr Cameron did secure an “emergency brake” on in-work benefits for EU migrants. But the German leader and François Hollande, the French president, opposed bigger curbs on free movement that could have assuaged voters’ concerns but would also have undercut one of the main principles of the EU single market.

4. If Johnson had backed Remain

By the end of the campaign, Boris Johnson was de facto head of the Leave campaign — and the politician most trusted on Europe by voters. Yet until late February, Downing Street thought he would back EU membership. Mr Johnson had doubts, writing two versions of his newspaper columns, one backing Remain, one backing Leave. He published the latter version and Leave found its figurehead.

5. If Cameron had agreed to a TV debate

In May, with a comfortable lead in the polls, Remain decided to scotch a TV one-on-one between Mr Cameron and Mr Johnson. Avoiding television debates worked for the prime minister in last year’s general election campaign; this time he said he wanted to avoid Conservative-versus-Conservative warfare In hindsight, a debate could have allowed Mr Cameron to deal a knockout blow — especially as Mr Johnson occasionally struggled in another encounter against Alex Salmond.

6. If Britain Stronger in Europe had chosen a business figure other than Stuart Rose

Lord Rose used to be seen as one of the most competent business leaders in Britain. But the usually urbane operator lost his touch early on in the campaign with a series of blunders and was quickly wheeled off the national stage. In one TV interview he got the name of the Remain campaign wrong — four times. On another occasion he said: “The benefits of being in the EU are outweighed by the costs!” But was the general public listening to UK plc? Not really, it turned out.

Lord Stuart Rose was criticised for not providing strong enough leadership in the campaign © Getty

7. If the vote had taken place in 2017

The Tory manifesto committed to a referendum by the end of 2017 but should Mr Cameron have waited longer? Sir Lynton Crosby, the Australian strategist who advised the Tories in their 2015 election campaign, apparently thought so. “Lynton was advising Dave and George to rip up the deal in Brussels and kick it all into 2017. His advice was to go to the summit, shout that it’s rubbish and then spend another year renegotiating,” one Tory told the Sunday Times. The renegotiation may have looked better for Mr Cameron; so might the outcome.

8. If Tony Blair had taken a more restrictive approach to eastern European immigration

Unlike most of its EU partners, the then Labour government of Tony Blair decided to give the immediate right to work to migrants from eight former communist countries that joined the bloc in 2004. Official estimates that those countries would provide a net inflow of 13,000 people a year proved far off the mark; in the 2004-12 period the cumulative net total was 423,000, as workers were attracted to Britain by opportunities for better pay and employment.

The scale of the influx has prompted widespread resentment, particularly in white working-class communities, fuelling the rise of Ukip. According to a 2015 survey by YouGov, the polling group, 75 per cent of people in the UK thought there had been too much immigration over the previous 10 years: the EU is widely held responsible.

9. If Jeremy Corbyn had inspired Labour voters to back Remain

This was always a stretch, given that the Labour leader has been an instinctive Eurosceptic for most of his adult life. He said he was in the Remain camp to reflect the will of the unions and the wider Labour party. But his heart never appeared to be in it. On one occasion he torpedoed his own side by accusing the Treasury of issuing scaremongering forecasts. In Mr Corbyn’s defence, however, there were millions of Labour voters, angry about immigration, who were not receptive to the Remain camp message.

Labour leader Jeremy Corbyn joined the Stronger In campaign but has never been a euro enthusiast © Getty

10. If the EU had not been wracked by crises

In recent years, the EU has often seemed to struggle with epic challenges that have tested its very existence. First was the eurozone crisis, which eroded trust in the institutions of the bloc. Since then the southern countries — Italy, Spain, Greece — have been wracked by economic problems and high youth unemployment. Then came the challenge of the Syrian civil war, with large numbers of refugees fleeing to the safety of Europe through the eastern Greek islands. Bickering among EU members over how best to address the migration crisis have once again damaged its reputation for competence.

11. But not if the Conservatives had failed to win a majority

This one sounds plausible but is not quite right. The theory goes like this: Mr Cameron promised the referendum in January 2013, at the time the Conservatives were about 10 points behind Ed Miliband’s Labour in the polls. The pledge was conditional on the Conservatives winning the next generation — seemingly a distant prospect. Both Labour and the Liberal Democrats opposed a referendum. Would the pledge have become a casualty if Mr Cameron continued the coalition with the Lib Dems after 2015?

In fact the Lib Dems would probably have allowed an EU referendum, eventually. Party insiders admit that it would have been a big bargaining chip in any 2015 coalition talks — one to be exchanged for other concessions such as using the “alternative vote” in local elections.