With President Barack Obama about to leave office, will the world be better or worse than eight years ago? Taking the big picture, so often obscured by the wars and uprisings that dominate the front page, more often than not he has resisted the foreign-policy establishment, most importantly in Syria, which makes a fetish of “credibility.” He has argued that “dropping bombs on someone to prove that you are willing to drop bombs on someone is just about the worst reason to use force.”

In an interview last April with Jeffrey Goldberg in Atlantic magazine, Obama said: “Where am I controversial? When it comes to the use of military power. There’s a playbook in Washington that presidents are supposed to follow that comes out of the foreign policy establishment. The playbook prescribes responses to different events, and these responses tend to be militarized responses. In the midst of an international challenge like Syria, you get judged harshly if you don’t follow the playbook, even if there are good reasons why it does not apply.”

Nevertheless, despite his good principles Obama leaves behind a Middle East in more of a mess than it was. The war in Afghanistan continues, with the Taliban gaining the upper hand. The US invasion of Libya, along with France and the UK, liberated not a country but a hornets’ nest.

The relationship with China is better in some aspects but worse in others. Obama has not made much effort to deal with nuclear-armed North Korea, constrained by Republicans in Congress who have sabotaged every previous government-to-government agreement. He leaves behind a dangerous state of affairs that might tempt his nuclear-minded successor Donald Trump to take pre-emptive action when it becomes clear in three or so years that North Korea has a nuclear-tipped missile than could reach Los Angeles.

Syria continues to be torn apart by civil war, with the US helpless on the sidelines. Despite the large amount of time attempting to broker peace between Israel and the Palestinians, Obama has failed. He has attempted to be neutral, but how that can be when he has just given Israel a massive new arms deal is to be wondered at.

The relationship with Russia has been nothing short of a debacle, culminating — in partnership with the EU — in making a total hash of the Ukraine crisis. He allowed the pace to be set by neo-fascist movements that wanted to provoke the government to confront Russia. Even worse, breaking a solemn American promise made to then-President Mikhail Gorbachev, he has expanded NATO right up to Russia’s border.

On the plus side, US recognition of Cuba has ended a too-long era of hostility. He has given strong support to the increase in UN peacekeeping. He has taken the lead with China in fighting climate change. He has pushed for policies that have brought down fast the number of child and maternal deaths in poor countries.

The deal with Iran, made with EU and Russian negotiating support to put firm limits on its nuclear program, was a masterpiece of diplomacy. The US killing of the head of Al-Qaeda, Osama bin Laden, put an end to a mass murderer but helped catalyze into action its replacement movement Daesh, which has set out to achieve the building of a region-wide caliphate in its own image.

Nevertheless, as Obama has pointed out, it extends over mostly semi-desert territory. He has refrained from being intimidated by it. He has said it is not the reincarnation of Saddam Hussein’s Iraq. He has understood that the threat to the US and Europe is not large and is containable.

Compared with his predecessor George W. Bush, Obama has been a model of constraint, prudence and openness. However, in foreign policy he has fallen badly short, although he has the good and valid excuse that he was badly hampered by inheriting the total mess created by Bush in Iraq and Afghanistan.

Professor Stephen Walt of Harvard wrote recently in Foreign Policy: “A genuine ‘realist’ foreign policy would have left Afghanistan promptly in 2009 (rather than surging the number of troops there by 60,000, albeit, Obama says, the Pentagon ‘jammed’ him on this); converted our ‘special relationships’ in the Middle East to normal ones, explicitly rejected further expansion of NATO; and eschewed ‘regime change’ and other forms of social engineering in foreign countries such as Libya or Syria.”

I agree. I give Obama six out of 10 for foreign policy, and eight out of 10 for domestic. Now over to Trump.

• Jonathan Power is a British journalist, filmmaker and writer.