He was the president who took out Osama bin Laden but was blindsided by Isis; who made Asia his priority but saw his trade deal for the region stymied; who built bridges with once sworn enemies in Cuba and Iran but who sparred with allies in Israel and Saudi Arabia.
The mixed and sometimes messy foreign policy legacy of Barack Obama includes a climate change agreement and nuclear deal with Iran that he hoped would become historic landmarks but which could now be under threat in the first month after his departure. It also includes an intervention in Libya — against instinct — that left chaos in its wake and a tortured attempt to avoid intervening in Syria that also ended in chaos.
After eight years of being slammed by conservatives as feckless for allegedly leaving a vacuum that Russia, Isis and others have jumped into, Mr Obama is being succeeded by a very different stripe of Republican who, instead, calls him reckless.
On the big picture, he tried to ease his country into a new era of more modest foreign policy ambitions that reflected the realities of a multipolar world but leaves office facing growing geopolitical confrontations with rising powers in Russia and China.
Supporters say that after the traumas of the George W Bush years, Mr Obama has played a steadying role that has shored up American influence and opened up new opportunities. “By most measurements, we are much better off than we were eight years ago,” says Derek Chollet, a former senior White House, Pentagon and state department official in the Obama administration.
Others point to grave threats the US now faces. “There are now two powers which are willing to challenge the international order,” says Jack Keane, a retired four-star general who was in the running to be Donald Trump’s defence secretary — referring to Russia and China. “They refuse to accept the international order that the US helped organise.”
Syria is the starting point for most conversations about the Obama foreign policy — and the subject with the greatest potential to stain his legacy. Mr Obama declared in August 2011 that Bashar al-Assad “must go”: more than five years and at least 400,000 deaths later, the Syrian regime is still grinding out battlefield victories.
The case against the president is twofold. First, that he missed the opportunity to back the moderate rebels fighting the Assad regime in the early months of the civil war, which allowed more radical elements to dominate the opposition. Second, his last-minute reverse in 2013 on bombing Syrian forces after their use of chemical weapons allowed the Assad regime to regroup — according to Mr Obama’s critics — and Russia to intervene decisively on its behalf two years later.
Mr Obama would respond that the opposition never had the coherence or will to genuinely challenge the Assad regime and its backers. Such a notion has “always been a fantasy”, he said in an interview last year, because the opposition was made up of “former doctors, farmers, pharmacists and so forth”.
Some in the administration believe the Syrian conflict should be a moment for reflection in Washington about the limits of American power to shape events in the Middle East. “He’s refused to allow his presidency to be dragged into the quicksand of the Middle East,” deputy national security adviser Ben Rhodes said last month.
The Syrian conflict also accelerated the rise of Isis — the jihadi group whose 2014 sweep across northern Iraq represents the other biggest blot on the Obama record. In 2011, US troops pulled out of Iraq after the administration failed to get the legal protection that would have allowed them to stay — an agreement critics say Mr Obama did not try hard enough to secure.
With little US presence in the country, sectarian tensions exploded and Washington had little insight into groups such as Isis that benefited from the infighting. Months before Isis took Mosul, Iraq’s second-largest city, Mr Obama had dismissed the group as the equivalent of a “JV”, or junior varsity, team.
As Mr Obama prepares to leave office, Isis is pinned down in Mosul and Raqqa, its stronghold in Syria. But fierce battles lie ahead in both cities and Isis will still likely be able launch terrorist attacks, including in the West.
When not absorbed by the Middle East’s dramas, Mr Obama tried to make Asia the central strategic priority for American foreign policy. Although it sometimes gets little credit, his administration has patiently reinforced the US position in the region by beefing up alliances and partnerships with Japan, Australia and Vietnam — even if its moves in the Philippines are now under threat.
However, the administration has failed on two fronts. The Trans-Pacific Partnership, the 12-nation trade deal championed as the cornerstone of American economic engagement in the region, is floundering after Donald Trump and Hillary Clinton both opposed it. The bigger dilemma is that Washington’s increased attention and presence in Asia does not seem to have diminished China’s ambitions — which had been the underlying objective. Instead, the US and China are drifting into a growing contest for dominance in the region.
The same is true of the US relationship with Russia. Like his predecessor, George W Bush, Mr Obama entered office hoping to mend fences with Moscow, and succeeded for some time. But with Vladimir Putin’s return to the presidency in 2012, the relationship has frayed by the month, culminating in the extraordinary allegations by US intelligence this month about Russian attempts to interfere in the presidential election.
Throughout, Mr Obama has tried to take a middle path with Russia, supporting strong sanctions over its annexation of Crimea and intervention in eastern Ukraine, but blocking proposals to send weapons to the Ukrainian government.
He was continuously mocked by his Republican opponents for being too soft on Mr Putin, who they accuse of wanting to undermine the West. In the final irony of his term in office, Mr Obama will hand over to an incoming Republican president who, by contrast, promises a new strategic alliance with Moscow.