BAGRAM AIRFIELD, Afghanistan (Reuters) - Notorious for leaks and chastened by previous security lapses, the White House went to unusual lengths to keep President Donald Trump’s Thanksgiving trip to Afghanistan under wraps, devising a cover story for his movements that included posting scripted tweets while he was in the air, administration officials said.

President Donald Trump eats dinner with U.S. troops at a Thanksgiving dinner event during a surprise visit at Bagram Air Base in Afghanistan, November 28, 2019. REUTERS/Tom Brenner

On Thursday, Trump dropped in unannounced on troops at Afghanistan’s Bagram military air base in his first trip to the country and only his second to a war zone during his presidency. He served soldiers a turkey dinner and posed for selfies, before telling reporters that the United States and Taliban hoped to resume peace talks.

Perhaps the most surprising aspect of the 33-hour roundtrip, which White House spokeswoman Stephanie Grisham said had been weeks in the making, was the administration’s success in keeping it secret until shortly before the president left Afghanistan to return home.

Frequently wrong-footed by leaks and Trump’s freewheeling use of Twitter, the White House informed only a tight circle of officials about the trip.

On Tuesday, Trump traveled to his Mar-a-Lago resort in Florida as scheduled, accompanied by the regular caravan of reporters which follows the president on all trips.

When those journalists waited for him to emerge for a Thursday afternoon conference call with the troops, per his official schedule, they learnt that overnight he had flown the 13,400 km (8,331 miles) to Afghanistan to visit them in person.

“It is a dangerous area and he wants to support the troops,” Grisham told a small group of correspondents aboard Air Force One on Wednesday evening, explaining why the White House had concealed Trump’s true movements.

Only hours before, that second group of reporters had secretly gathered at a parking lot near the Joint Base Andrews outside Washington, a regular departure spot for Trump, from which they were driven in minivans into the complex.

They had been told ahead of time that Trump would be traveling incognito to an undisclosed location.

Once inside the base, all smart phones and any devices that could send a signal were confiscated and not returned until at least two hours after Trump’s arrival at Bagram, the largest U.S. base in Afghanistan.

Throughout the 13-hour flight, nobody on board Air Force One had access to their phones, including White House staff, Grisham said. The cabin lights were mostly switched off and window blinds stayed shut.

Last Christmas, en route to a troop visit in Iraq, Air Force One was identified above England by a plane spotter who tweeted a photo of its distinctive turquoise livery, sparking a social media storm. Many speculated then that Trump was on his way to a war zone, pointing to his unusually quiet Twitter account, which had sent dozens of tweets the day before.

This time, Grisham said the White House made arrangements to ensure continuity in the president’s Twitter account, which posted happy Thanksgiving tweets as he was in the air, including one thanking the military.

“We just had a nice Thanksgiving dinner,” Trump said amid chants of “U-S-A” during his speech at the Bagram base.

“I thought I was going to be doing it someplace else.”