The irony of Barack Obama’s presidency is that while it began at a time when it seemed America’s fortunes could only improve, his inauguration day turned out to be his personal high water mark.

The retiring President’s speech in Chicago this week contained flashes of the optimism that he brought to a country and a world which was reeling from the banking crisis and mired in the deepest recession since the 1930s. It recalled the sense of hope that he would lift America’s reputation abroad, shattered as it was by the Iraq war.

Yet eight years on, even Obama’s keenest supporters are struggling to answer: what exactly is his legacy? ‘Yes, we did,’ he roared to the crowd, in reply to his old rallying cry of ‘Yes, we can.’ But did what? By every measure, he claimed, ‘America is a better, stronger place.’ It is hard to square that with the fractious country he leaves behind.

The cold reality is that Obama’s legacy is Black Lives Matter on the one hand and Donald Trump on the other. Of all things, Obama was supposed to be a unifier.

Yet those who had to live under his higher taxes and studied his administration more closely see a man who preached unity and went on to practise partisanship. Bill Clinton realised that it is cross-party deals which tend to endure — his pioneering achievement in welfare reform was the result of his working with Republicans. Obama, by contrast, approached his reforms by trying to overrule legislatures over which he did not have full control. That is why much of his legacy now looks set to be dismantled.

Many believed that Obamacare would be the President’s lasting achievement. Instead it looks doomed, its flaws exposed. Insurance companies are withdrawing from it, premiums are rising sharply — and still there are 29 million Americans without health insurance or cover under Medicaid. America’s economy improved, as it only could. Yet few believe that the banking system has been corrected. On the contrary, the view of many Americans is that Wall Street got away it — bankers were bailed out while ordinary Americans paid the price.

As for the Democrats, it seemed at first as if Obama would rejuvenate them. Instead, they have aged and withered. Who could name an inspiring left-of-centre leader who is not of pensionable years? It is a party whose high command is represented by Hillary Clinton, 69, and Elizabeth Warren, 67, and whose rebellious streak is provided by Bernie Sanders, 75. Worse, the Democrats have become the party of the aloof insider, of government talking down to people. It takes something when you allow a plutocrat opponent to beat you by posing as a man of the people — yet that is what the Democrats have achieved.

It is easier to admire Obama from abroad, away from his domestic failures. Yet on foreign policy, too, he has fallen sadly short of expectations. A man bestowed with the Nobel Peace Prize after only a few months in office spent the next seven years doing nothing to deserve it. Faced with the Syrian crisis, he didn’t invade as George W. Bush and his neocon henchmen might have done. But has the outcome been any better? Syria is in as much mess as post-Saddam Iraq was, and Islamists remain undefeated. In setting Assad red lines which he was then allowed to cross, Obama made America look pathetically weak and created a power vacuum which Putin has been only too eager to fill.

On Iran, Obama promised to lift sanctions and re-admit the country to global trade in return for an end to its nuclear weapons programme. Obama stuck to his side of the bargain, but Iran has been allowed to carry on importing uranium from Russia and developing long-range missiles without sanction.

The best thing about Barack Obama’s presidency is that it happened at all. His election was a sign of America’s progress: that a country could go from Jim Crow to electing a black president in two generations. Obama’s calm demeanour was the perfect counter to those who saw America as an aggressive nation. But his personal attributes did not translate into policy success.

Nor was he able to address growing racial tension. Building a ‘post-racial society’ was unrealistic, he now admits. That is to put it mildly — last summer a poll suggested that 69 per cent of Americans believed race relations in the US to be ‘mostly bad’. For all his oratorical gifts, Obama failed to find a language that emphasised both social justice and national pride. He should not have defended Colin Kaepernick, the sportsman who in protest at racial discrimination refused to stand for the national anthem. Kaepernick was born in poverty to a single mother who put him up for adoption. He shone at school and was offered a full sports scholarship to the University of Nevada. At the age of 27 he signed a $143 million deal with the San Francisco 49ers. Kaepernick’s story is possible only in America, yet he refused to sing.

And now a disappointing president gives way to a preposterous one. The only hope is that Donald Trump may surprise on the upside, by governing in a better way than he campaigned. His tax cuts may pass power to ordinary Americans, who would undoubtedly use it more wisely than his government. He may drop his protectionist instincts.

In no sense has America been transformed by its first black president. On the contrary, it begins a new chapter in a weaker position internationally, and with starker social divides and a more pessimistic outlook than at Obama’s inauguration eight years ago.