From the moment Barack Obama touched down in China, his last G20 summit seemed likely to be a tricky one.
A kerfuffle over aircraft stairs -- or lack of them -- and overzealous Chinese apparatchiks drowned out Obama’s efforts to laud his “pivot” to Asia and a deal between Beijing and Washington to jointly ratify a major climate accord.
By the end of Obama’s three days in Hangzhou, he would have to contend with yet more inconclusive talks on Syria, prickly Turkish allies, a mouthy Filipino ally and attention-seeking North Koreans firing off a battery of ballistic missiles.
Obama’s first full day in China started with a charm offensive aimed at elevating Britain’s new Prime Minister Theresa May.
Instead of the usual photo and statements in a featureless meeting room, May was put, if not on a pedestal, then on a stage with a podium and all the trappings of state, side-by-side with Obama.
The White House is keen to make sure the “special relationship” still feels at least a bit special, even if Britain has become tangled in a political thicket and diminished in stature by its vote to leave the EU.
Obama’s next task was to mend fences with Turkish President Recep Tayyip Erdogan, who since a July coup, has worried the White House by repeatedly stirring up anti-US sentiment.
If public opinion were to shift against America in a Muslim democracy, one which is at the crossroads of Europe and the Middle East and is a major NATO ally, it would be a strategic disaster.
Obama was worried enough to dispatch his vice president to Turkey last month to cool the situation, with mixed results.
Meeting face-to-face for the first time since the attempted putsch, Obama went out of his way to praise the Turkish leader.
He also offered reassurances that Erdogan’s Pennsylvania-based opponent Fethullah Gulen would be extradited if he did have hand in the coup plot.
In return, Erdogan toned down direct criticism of the United States, even describing relations under Obama as a “model partnership.”
“The relations between our countries are very special and they are getting stronger as time goes by,” he said.
But the warm words were not enough to solve a rift between Washington and Ankara about the YPG, a Syrian-Kurdish group that Obama has backed and Erdogan has bombed.
Erdogan branded the militia a “terrorist organization” and baldly declared: “We have to embrace the same stance against all terrorist organizations around the world.”
He also lumped Gulen in that group, decrying the “Fethullahist terrorist organization.”
Obama may be willing to extradite Gulen, if there is enough evidence, he is perhaps less likely to ostracise the YPG.
The group forms the spine of the Syrian Defence Force, which will be vital if Islamic State group’s “capital” at Raqqa is to be retaken.
To shore up Kurdish support, Obama was forced to send another lieutenant, his special envoy Brett McGurk, to Syria with a pledge of “ongoing US support,” according to the State Department.
Obama’s problems with US allies did not end there.
On the eve of a planned meeting with Rodrigo Duterte, the Philippine President’s description of Obama as a “son of a whore” forced the US president to call their appointment into question.
That would be a relief for Filipino officials nervous about what their unscripted and impolitic leader might say behind closed doors.
But with Manila locked in a territorial dispute with China over the South China Sea, it could use US support.
During Obama’s time in China, US foes proved a little more reliable.
North Korea’s decision to fire three ballistic missiles off its east coast, was just the latest in a series of provocations.
But ahead of an East Asia Summit in Laos, it may help Obama both make the case for tougher Chinese action against Pyongyang and for that EAS grouping to play a bigger security role, acting as a forum to address and defuse regional tensions.
News from Syria proved that the country’s troubles can always get worse, with the regime again attacking Aleppo in an effort to besiege the city.
That came just as Secretary of State John Kerry was trying to negotiate at least a partial truce with Syria’s backer, Russia.
It was not to be.