WASHINGTON (AP) -- Aides to President Donald Trump were in deep talks about how to defuse tensions between Qatar and other Arab nations when the door to the secure room at the White House burst open.
The urgent message: Trump had just tweeted about Qatar.
One adviser read the tweet aloud and with that, the policymakers in midconference call had no other choice but to rework their plans to reflect the president's tweeted assertion that Qatar, host to some 11,000 U.S. troops, was funding terrorism.
It was an accusation against a close U.S. ally that had never been voiced so publicly and with such indelicacy.
The incident, relayed to The Associated Press by two people on the interagency call, offers a glimpse into the erratic business of crafting policy in the age of Donald Trump.
Where carefully crafted policies ideally precede public messaging, advisers now often scramble to reshape policy to catch up with the president's tweets and public declarations.
On subjects from Qatar to Russia and, most recently, his surprise call for a ban on transgender people in the military, the president's tendency to tweet his mind is blindsiding advisers and, in some cases, complicating or even upending administration policy.
"When presidential advisers are caught flat-footed by a policy announcement, the story tends to be about how the decision was made, not the decision itself," said Bradley Blakeman, an adviser to former President George W. Bush. "It is a process and communications challenge."
Policymakers worry that Trump's tweets produce an inconsistent message. They're hoping Trump's selection this week of retired Marine Gen. John Kelly, known for his military discipline, to be White House chief of staff may help to streamline policymaking and convince the president that his tweets can create chaos when they're at odds with administration policy.
Trump's tweet about transgender policy last week made public a decision that military advisers had not agreed to.
Gen. Joseph Dunford, chairman of the Joint Chiefs of Staff, responded with an internal memo to military service chiefs stating that, for now, "there will be no modifications" to current policy.
The president's tweet prompted some GOP lawmakers, including Sen. John McCain, R-Ariz., to speak out.
"I think generally speaking, it's accepted you consult the secretary of defense before you make a decision that has to do with defending the nation," McCain said.
Secretary of State Rex Tillerson signaled this week that Trump's sometimes incendiary tweets are just "part of the environment in which we work."
"We'll adapt to it," Tillerson said. "There's a lot of unexpected things that happen to us in the world of diplomacy and we know how to adapt to that, we know how to work with it. I don't view it as an obstacle, hindrance or as assistance. Whatever the president chooses to express, he expresses, and then that's information to everybody - us included."
Douglas Brinkley, a presidential historian with the James A. Baker III Institute for Public Policy, said that a public pronouncement that undermines existing policy "corrodes morale at the bureaus and agencies because they're hearing their leader say things that they know aren't true or can't be implemented."
"It creates a culture of mistrust within your administration," he said. "That started happening with Nixon but that only happened in his last year when things started corroding all around him."
While the president has generally been more cautious about declarations related to Russia, in July he proudly tweeted after his meeting with Russian President Vladimir Putin about working with Moscow on "forming an impenetrable Cyber Security unit so that election hacking, & many other negative things, will be guarded."
The idea was widely and swiftly criticized, and the backtracking quickly commenced. First, Trump's advisers defended the idea, then they cautioned that the cyber unit was just an idea floating around. Shortly thereafter, the president tweeted: "The fact that President Putin and I discussed a Cyber Security unit doesn't mean I think it can happen. It can't-but a ceasefire can, & did!"
Trump has also made public pronouncements on Twitter about Afghanistan and Syria, but the U.S. policies toward those countries remain in flux as the administration attempts to find solutions to those conflicts while learning from the mistakes of past administrations.
And while disputes like the standoff over Qatar may be eased with a bit of skillful diplomacy, offhand tweets can risk major international incidents and raise legal issues in some cases.
For example, as conservative pressure builds for Trump to do away with the Obama-era Iran nuclear agreement, policymakers worry that the president might tweet something offensive about the fragile accord, jeopardizing any progress that has been made.
Trump's tweets on health care policy seem to have caught the eye of judges on the federal court of appeals in Washington, who this week issued a procedural ruling counter to administration interests in a case involving billions of dollars in "Obamacare" subsidies.
In allowing a group of state attorneys general to intervene in the case, the appeals courts said states' doubts that the administration could adequately defend their interests in court were fanned by "accumulating public statements by high-level officials ... about a potential change in position."
"He's really a terrible client, President Trump is," University of Michigan law professor Nicholas Bagley said. "The states point to his public statements and say, 'Are you kidding me? We know the president is poised to throw us under the bus and we know because he said so.'"
Bill Galston, a former Clinton administration official now at The Brookings Institution, said there is a standard process in policymaking that most administrations strive to follow.
He cautioned: "If the president is not prepared to accept an orderly policy process with all of the restraints on individual conduct and behavior, then the new chief of staff will not have the power to implement policy."
Associated Press writers Josh Lederman and Ricardo Alonso-Zaldivar contributed to this report.