Thursday’s referendum on Europe was always meant to be British Prime Minister David Cameron’s ultimate victory, a once-and-for-all resolution of an issue that had divided his Conservative Party for a generation. In the end, the schism over Europe proved so deep and irreconcilable that on Friday it brought a sudden end to his tenure.

Just 13 months ago, Cameron stood outside No. 10 Downing Street, having delivered an unexpectedly strong victory in a general election that restored a Conservative majority in Parliament for the first time in nearly two decades. On that day, he stood atop British politics, enjoying what seemed a relatively free hand to exercise his powers.

That 2015 campaign forced the leaders of the rival Labour and Liberal Democrat parties to step down in defeat. Cameron offered a gracious tribute to the fallen. “Elections can be bruising clashes of ideas and arguments,” he said, “and a lot of people who believe profoundly in public service have seen that service cut short.”

Those words proved prophetic and personal on Friday, though Cameron could not have imagined that little more than a year later, an even more bruising campaign would cut short his time in office. As Tony Travers of the London School of Economics said Friday as he tried to sum up Cameron’s tenure, “He was a very lucky politician, until his luck ran out.”

After months of campaigning, the “leave” camp has won and Britain will be leaving the European Union. The Post’s Adam Taylor talks about what that means for the country and Europe. (Adam Taylor,Jason Aldag/The Washington Post)

When Cameron seized the leadership of his party in 2005, he was the fresh, young face on a tired old party. On Friday, hours after voters here had delivered a stinging rebuke to him and the whole political establishment by calling for Britain to withdraw from the European Union, Cameron acknowledged that the outcome now demanded “fresh leadership” again to implement the will of the voters.

His time as prime minister probably will be remembered in large part by the vote that shocked the world and cost him his job. But the arc of his leadership included far more than this moment. When he won the leadership fight in 2005, the Conservative Party — the most successful party in British history — had lost three successive elections to the Labour Party. Within five years, he had brought the Tories back into power, albeit as the senior partner in a coalition government with the Liberal Democrats.

“It’s important that we don’t see everything through the prism of this referendum vote,” said Tim Bale, a professor of politics at Queen Mary University in London.

Cameron promised a British version of compassionate conservatism. He envisioned a Big Society, a more communitarian approach to certain social policies that was to sand off the rough edges of previous Conservative leaders. He pushed successfully for legislation legalizing same-sex marriage in Britain. His economic policies drew criticism from Labour politicians as harsh and austere, but he managed to win the 2015 election in spite of that.

Cameron inherited two continuing debates about the unity of Britain. One was an independence movement in Scotland whose leaders were determined to break free of the central government in London. In 2014, the issue was put before the voters: “Should Scotland be an independent nation?”

Cameron threw himself into that campaign. He promised reforms ahead of the vote and rallied support to keep Scotland within Britain. When a solid majority of Scots rejected the independence movement, Cameron reaped much of the credit.

By then, however, he was already committed to another referendum, this one on the future of Britain in Europe. It was a pledge made as much out of weakness as out of conviction. He was facing a back-bench revolt on the issue of Europe, and his own members were increasingly worried about the rise of the U.K. Independence Party (UKIP). The promise of a referendum was in part a tactic to hold off UKIP in vulnerable Conservative-held districts.

“I think what happened here is testament to the fact that modernization was always incomplete,” Bale said. “On Europe, he appeased them. He gave them an inch, and every time they took a mile and eventually pushed him into a referendum he didn’t want to hold, and this is the result.”

Martin Kettle of the Guardian noted in a column Friday that Cameron called himself a Euroskeptic, though one who was not as committed as many in his party were. That seeming ambivalence left him in the awkward position of proposing the referendum on the European Union and then leading the fight to defeat it.

Even before Thursday’s outcome was known, there was criticism of Cameron — for promising the referendum in the first place and then running what was considered a lackluster campaign on behalf of a vote to remain in the E.U.

Cameron said Friday he had thrown “head, heart and soul” into the fight, and in the closing days of the campaign, polls suggested that his bet would pay off. A vote to remain in the E.U. would deprive the Euroskeptics of oxygen for the foreseeable future and also help quash talk of a second Scottish independence referendum.

Now Britain is heading out of Europe.

And with Scotland voting to stay in, Nicola Sturgeon, the leader of the Scottish National Party, on Friday said a second independence referendum is “highly likely.”

In the hours immediately after the polls closed here Thursday night, when a just-released Election Day poll suggested that the outcome would be a vote to remain in the E.U., Patrick Dunleavy of the London School of Economics offered an assessment of Cameron as potentially the first prime minister in 80 years who could leave office as not a failure. “If it’s a remain victory, he’s a very successful premier,” Dunleavy said.

Less than an hour later, as early results from northeast England showed stronger-than-expected support for the “leave” campaign, that assessment was undergoing a dramatic revision — and by morning, Cameron’s decision to resign had become inevitable.