2020 vision: The Obama years were all very well, but what this country needs is the decisive might of a military man

As the make-up girl dusted and dabbed, David Petraeus could not suppress a quiet smile of satisfaction. Here he was at the end of 2019, three years in the Oval Office, with approval ratings that Ronald Reagan might have killed for – and an interview on the country's most-watched television talk show to launch what would surely be a triumphal march to re-election the following November.

In retrospect, it seems obvious that in a moment of self doubt, America had again chosen a soldier as its leader. Back in 2008, faced with a comparable crisis, the country elected its first black president. But the charismatic candidate had proved a disappointment, oddly passive when the moment demanded a call to arms, and unable to impose his will on a Congress that regarded him as a soft and youthful touch.

In the end, Barack Obama did win a second term in 2012, but only narrowly. He owed victory less to his own merits and achievements than to the internal divisions that made the Republican Party all but unelectable. Obama's opponent that year was a doctrinaire conservative who had romped through the primaries but unnerved independents and centrists. These latter, however reluctantly, went for the devil they knew in Obama.

In reality, when Obama was sworn in for that second time, the problems he faced were virtually the same as on that brave new dawn of 20 January 2009, when for an illusory moment all things seemed possible. True, the economy was growing again – but unemployment was only a whisker below 10 per cent. The budget deficit was stuck at over $1tn, the trade deficit was still huge, and the Chinese more than ever ruled the economic roost.

Obama's one stroke of fortune was the Iranian uprising of early 2011 that forced out Mahmoud Ahmedinejad, and led to a deal on the country's nuclear programme, averting another and even deadlier US conflagration in the Middle East. Petraeus meanwhile, as chief of US Central Command, had done his part as well, by helping extricate the US from the seemingly endless and desperately unpopular wars in Iraq (where American troops completed their pullout in 2011), and in Afghanistan, where by 2014 the US ground presence had shrunk from over 100,000 in 2010 to a politically acceptable 10,000.

By then, however, the Obama administration was exhausted. True, versions of its signature measures to overhaul health care, energy policy and rein in financial markets, had been passed – but only after a dysfunctional Congress had virtually rewritten them, eliminating the savings and efficiencies they were meant to bring in.

But, once again, the opposition had no credible candidate. The Republicans' one star, a former governor of Alaska, had decamped to the richer pastures of television, while the party had not found a philosophy to replace the free market doctrines discredited by the financial crash of 2008 and the Great Recession that followed.

By then, the military was practically the only institution Americans trusted any longer. In late 2013 Republicans were already putting out quiet feelers to Petraeus, the military's most prestigious general, to be their standard bearer in 2016. Publicly, he demurred. In private, like General Dwight Eisenhower in 1952, he signalled he would not be averse to a summons. After romping through the late primaries, Petraeus was nominated by acclamation at the Republican convention in Cleveland in August 2016, and won the White House by a landslide that November.

What matters for presidents, like generals, is not so much to be good as to be lucky – and Petraeus was. He was shrewd, always careful not to promise more than he could deliver. But he could not have bargained for the turmoil in China, as the population demanded political freedom to match their new economic prosperity – nor for the success of new technologies to extract natural gas from shale, that would drastically reduce the country's dependence on imported energy, and its huge and debilitating trade deficit. Even the dollar was strengthening, after two decades of decline.

Less tangibly, but no less important, Americans finally came to realise that terrorism was not an existential threat, while the world came to understand that the power of the US was finite, and consequently did not demand as much from Washington as before.

So one way and another, things were finally improving after the decline of the Bush and Obama years. So popular indeed was the 45th president by this Christmas of 2019 that some commentators, looking beyond the formality of re-election, urged a change in the constitution to allow him to run for a third term in 2022, when he would be 70. But suddenly, the reverie of President David Petraeus was interrupted. The make-up girl was finished. The cameras of The Sarah Palin Show were ready to roll.