David Cameron was the British prime minister who came into office promising to stop his party "banging on about Europe", but ultimately saw his premiership brought down by the issue.

History is likely to remember him principally as the prime minister who took Britain out of the European Union - and maybe, if Scotland presses ahead with a second independence referendum, as the man who set in train the break-up of the United Kingdom.

It is all a far cry from the agenda Mr Cameron had in mind when he was elected as the Conservatives' fresh-faced new leader at the age of just 39 in 2005.

With Tony Blair still in his pomp, the newcomer consciously modelled his approach on the three-time election-winner on the other side of the despatch boxes - though claims he styled himself the "heir to Blair" have never been confirmed.

Dismissing Mr Blair with the well-aimed jibe "He was the future once", Mr Cameron portrayed himself as a modernising leader, with liberal social attitudes and an optimistic vision of a kinder, gentler Britain.

Under the tutelage of shoeless policy guru Steve Hilton, he tied his colours to the mast of the Big Society, promising to boost communities through volunteer work, improve Britain's "general well-being", tackle climate change with rooftop windmills and "let sunshine win the day".

But the photo-shoots with hoodies and huskies came to an abrupt end with the financial crash of 2007/08, when Mr Cameron and then shadow chancellor George Osborne ditched promises to match Labour spending pound-for-pound and "share the proceeds of growth" in favour of the austerity which dominated their time in office.

In a highly effective piece of political positioning, they ensured that blame for the crash was attached firmly to the administration of Labour's Gordon Brown for failing to "fix the roof while the sun was shining".

But public anger over the economy was not enough to win Mr Cameron untrammelled power.

Conservatives fell short of an overall majority in the 2010 general election, and the Tory leader took the bold step of making a "big, open and comprehensive" offer of coalition with the Liberal Democrats.

Despite gloomy predictions, the first coalition in post-war political history survived for its full five-year term, overseeing a package of "fiscal consolidation" which saw deep cuts to public spending as well as hikes in taxes including VAT in an effort to eliminate the country's record deficit.

Mr Cameron sent British warplanes to assist rebels in Libya, but faced defeat over his plans to intervene in Syria.

He crushed Lib Dem hopes of electoral reform in a referendum on a new voting system, and rather more narrowly saw off the threat of Scottish independence in another public vote in 2014.

Deficit targets were missed and dissatisfaction grew over mass immigration and cuts to welfare, but it was Nick Clegg's Liberal Democrats who paid the price at the ballot box, all but eradicated from the House of Commons in 2015 by voters who would not forgive them for hikes in university tuition fees which they had vowed to oppose.

To Mr Cameron's apparent surprise, he was finally able to govern alone, albeit with a slender majority of just 12.

But freedom from the constraints of coalition contained the seeds of his destruction. In a move designed to placate restless backbenchers and see off the threat of defections to the resurgent Ukip, Mr Cameron had offered in 2013 to renegotiate the UK's membership of the EU before holding an in/out referendum during the first half of the next parliament.

Many in Westminster suspect that the referendum might have been a promise designed to be given up in post-election coalition negotiations. But without Lib Dem partners to blame, Mr Cameron had no option but to press ahead and - perhaps emboldened by his earlier poll triumphs - seemed confident of a victory which would have neutralised the European issue for the remainder of his time in office.

However, voters were less than impressed by the concessions wrung out of the EU in tortuous negotiations in Brussels. And the surprise defections of old friend Michael Gove and popular leadership rival Boris Johnson gave the Leave camp rocket-boosters in a campaign which saw the public turn a deaf ear to the warnings of the dangers of Brexit from scores of experts lined up by Downing Street.

As dawn broke on the morning after the poll, Mr Cameron recognised that he had lost and stepped outside Number 10 to declare that he was leaving at a time not of his choosing, becoming the third successive Conservative PM to be brought down by Europe.