Donald Trump's unannounced Christmas visit to US troops in Iraq succeeded as a morale-boosting exercise, judging from the standing ovation the president got. Equally, and perhaps predictably, the trip had its controversial moments - and his legendary attachment to social media had something to do with it.
Recognition: 'We're no longer the suckers'
Mr Trump travelled to al-Asad airbase, west of Baghdad, to thank armed forces personnel for what they had achieved in Iraq against Islamic State (IS), the Sunni Muslim militant group, during his tenure as commander-in-chief:
"Two years ago when I became president they were a very dominant group, today they're not so dominant any more. Great job."
"We're no longer the suckers, folks," he said. "We're respected again as a nation."
Mr Trump was accompanied by First Lady Melania Trump on the first trip of his presidency to a war zone. The couple walked amid troops, posing for selfies and signing autographs.
More than 5,000 US troops remain in Iraq to train and advise local forces, who are fighting what remains of IS following a string a victories last year.
Exposure: Did smiling Navy Seals know the whole world would see their faces?
Shortly after he left Iraqi airspace, Mr Trump proudly shared a video of what he'd been up to during the visit.
But it didn't take long for eagle-eyed watchers to point out something it seemed Mr Trump and his team might have missed.
It appears that those in the video include an elite US Navy Seal team, according to Newsweek. A team, the magazine pointed out, which would usually have their identities protected.
Malcolm Nance, a former US Navy intelligence specialist, told the magazine it would be a very unusual decision to picture them so clearly while on duty because, if any of them were captured, "there would be no denying who you are and what you do".
Mr Trump also took a selfie with US Navy Lt Cmdr Kyu Lee, who told him he was with Seal Team Five - a fact later reported by the pool of reporters travelling with the president.
The White House has not commented on why they decided against taking such precautions, as some of his predecessors did.
Fiction: What was the pay rise figure?
The president also announced that he had secured a sizable pay increase for troops.
Some of his advisers had suggested 2, 3 or 4%, he said, adding that he had made clear that this was not enough: "I said: 'No. Make it 10%. Make it more than 10%.' Because it's been a long time, it's been more than 10 years."
But as a number of US commentators noted, armed forces personnel have in fact received a pay rise in each of the past 10 years.
The increase for 2019, approved by Congress and signed by the president in August, will be 2.6%.
It is the largest rise for troops since 2010, but not significantly more than last year's 2.4%.
Secret's out: Trump's plane tracked
Any trip by a US president has to be planned down to the last detail, to make sure there are no holes in the security arrangements.
A trip to an active war zone has to be planned with special care - and secretly.
Mr Trump was apparently very happy, regaling reporters with tales of how they had travelled with the windows closed and lights off so as not to attract any attention.
But unfortunately, when you are in arguably the world's most recognisable aircraft, the chance of being spotted is always high.
And on this occasion, Alan Meloy captured a perfect image of the plane soaring over Sheffield, UK, on Boxing Day.
From there, Twitter sleuths and plane enthusiasts began to track the aircraft as it made its way across Europe and to Iraq, with a number of people guessing where it was headed.
Now, I'm not saying Trump is currently heading to the Middle East to visit troops. BUT...— CivMilAir ✈🎅🎄🐈 (@CivMilAir) December 26, 2018
There's been some interesting aircraft movements the last couple of days. Some I've already tweeted... And a VC-25A has been reported over the UK earlier today.
Watch this space! 😌
Mr Trump is, of course, not the only president to travel on Air Force One on a secret visit to a warzone. His predecessors have done so.
However, the fact it was quite so easy to follow what the president was doing had more than a few people concerned.
"Sources telling me Trump's on his way to visit troops - possibly in Iraq. Better late than never," tweeted Paul Rieckhoff, founder of Iraq and Afghanistan Veterans of America.
"But also a bit troubling that so many folks seem to already know about this if it hasn't happened already. #OpSec anyone?"
Friction: Iraqi host not too pleased
President Trump was due to meet Iraqi Prime Minister Adel Abdul Mahdi during the trip but the talks were cancelled over what Mr Mahdi's office called "disagreements" over organisation.
Iraqi MPs told Reuters news agency that Mr Trump had asked for the meeting to take place at the al-Asad military base, an offer declined by the prime minister.
When asked if he had had concerns about the visit, Mr Trump told reporters: "Absolutely. I had concerns for the institution of the presidency - not for myself, personally. I had concerns for the first lady, I will tell you."
Mr Mahdi's office said US officials had given Iraq advance notice of the presidential visit, but powerful local figures clearly took umbrage.
Sabah al-Saadi, who leads the Shia Muslim parliamentary bloc Islah, called it a "blatant violation of Iraq's sovereignty".
Qais al-Khazali, commander of Asaib Ahl al-Haqq, Iraq's most powerful Shia Muslim militia, also objected to the trip. He warned in a tweet that parliament would respond to the visit by "forcing the US troops to leave Iraq".