* PM leaves office just 14 months into second five-year term
* Modernised Conservatives after three election defeats
* Brexit defeat overshadows economic record
By Mark Trevelyan and William James
LONDON, July 13 (Reuters) - Until last month, the advice David Cameron chose to give fellow British parliamentarians on his last day as prime minister on Wednesday might have seemed apt.
"Nothing is really impossible if you put your mind to it," said the man who had rescued his Conservative Party from the political wilderness, won two elections and successfully gambled that Scots would stay in the United Kingdom if given the choice.
It sounded strangely off-key, however, given the circumstances of his own downfall - the outcome of a failed gamble that Britons, given the choice, would choose to stay in the European Union.
The June 23 referendum vote for 'Brexit' not only made Cameron's own position untenable but left both Britain and the EU facing years of uncertainty as they try to forge new rules on trade, investment, migration and a string of other key areas.
It was not supposed to end like this for Britain's youngest prime minister in nearly two centuries, who navigated five years of coalition politics to win a narrow majority in 2015 on a platform of economic recovery and social reform.
The obstacle he found impossible to surmount was the long-running euroscepticism within his own party, which, along with a perceived threat from the new, anti-EU UKIP party, persuaded him to try to lay the issue to rest by calling a plebiscite.
"I think it's right when you're trying to settle a really big constitutional issue, you don't just rely on parliament, you ask the people as well," Cameron told parliament when asked, tauntingly, if he had succeeded on the issue of Europe.
"We made a promise, and we kept a promise."
Voters ignored Cameron's warnings that going it alone would be a "leap in the dark" that would bring on a self-inflicted recession and Cameron himself underestimated public anger at the establishment, exacerbated by his government's spending cuts.
Steven Fielding, politics professor at Nottingham University, said the prime minister could have told his party a referendum would done too much economic harm.
"For the effect that it will undoubtedly have on Britain, and for the fact the British people decided to take the decision that was the very opposite to the one he was personally recommending, he will go down as a complete failure in terms of the direction he wanted to take Britain in."
Considering the reasons for Cameron's downfall, his former Oxford University politics tutor Vernon Bogdanor pointed to the "huge popular eruption" of anger reflected in the referendum, and the widening of the gap between politicians and the people.
"Although his heart was in the right place about dealing with those problems, the gap certainly, I think, increased under his premiership," said Bogdanor, now research professor at King's College London.
Some commentators have compared Cameron's departure to the ignominious exit of prime minister Anthony Eden after Britain and France's failed military attempt to recapture control of the Suez Canal from Egypt in 1956. Bogdanor disagrees.
"Eden was defined by Suez because he wasn't prime minister for very long. I don't think Cameron will be defined just by Europe."
Answering questions from MPs for the final time as prime minister, Cameron trumpeted his economic record: 2.5 million more people in work, millions of apprenticeships, a growth rate among the highest in the developed world.
Under his finance minister George Osborne, the budget deficit narrowed from more than 10 percent of gross domestic product to less than 4 percent, although that came at the price of deep and painful cuts to public spending.
Cameron overcame three successive election defeats for his Conservative Party by changing its image from that of a party of the wealthy and old to one more in touch with modern life.
He legalised gay marriage and hauled the economy out of deep recession after the global financial crisis.
But his calls for a 'Big Society' and austerity mantra of "We're all in this together" rang hollow for many Britons, distrustful of his wealthy background and education at Eton College, an elite boarding school west of London.
On the world stage, Cameron committed British military support for the Libyan opposition that overthrew autocrat Muammar Gaddafi in 2011, a decision he defended despite the years of chaos that ensued. He suffered a humiliating and unexpected defeat in 2013 when parliament voted to reject military action against Syrian President Bashar al-Assad.
At home, in an earlier referendum gamble, he gave Scots the opportunity to vote on independence in 2014, and indiscreetly revealed that Queen Elizabeth had "purred" with pleasure when told they had chosen to stay in the United Kingdom.
But the independence question has resurfaced in the wake of the Brexit vote, in which Scots favoured remaining in the EU, a second major issue that he has failed to lay to rest.
In parliament on his last day, Cameron tried to address the public disconnect with the political class by praising MPs for their diligence as public servants. But he mainly kept things light, projecting the breezy confidence that contrasted with his tortured predecessor, former Labour leader Gordon Brown.
"I was the future once," Cameron said. "Other than one meeting this afternoon with Her Majesty the Queen, the diary for the rest of my day is remarkably light." (Editing by Philippa Fletcher)
Our Standards: The Thomson Reuters Trust Principles.