President Trump's announcement that he plans to ban transgender people from serving in the military made an end run around Defense Secretary James Mattis, calling into question a relationship that so far has seemed solid.

Until now, Trump has given Mattis latitude to do as he sees fit, granting the retired four-star general power to manage troop levels and other operational aspects of the United States' wars in Iraq, Syria and Afghanistan.

But on the issue of transgender troops, conservatives who worried that Mattis was steamrolling them won out, with Trump siding with them less than a month after Mattis committed to a six-month review of the issue.

"It's never a good sign when a major policy pronouncement is made that was clearly not coordinated with senior leadership," said a source familiar with the matter. "I can tell you, no matter how they're spinning it, I was there that day, and everybody was caught - all the senior officers who were left there with Gen. Mattis on vacation - they were all caught totally flat footed. They were all scrambling, because they were getting killed by Congress for not giving a heads up."

On Wednesday, Trump declared on Twitter the military would have a new policy on transgender service members.

The military, Trump said, would "not accept or allow" transgender people to serve "in any capacity." Trump claimed he made the decision after consultation with "my generals and military experts."

The White House said Wednesday that Trump made his decision on Tuesday and informed Mattis that day.

But on Thursday, the Pentagon made clear that it does not consider a tweet an order. Joint Chiefs of Staff Chairman Gen. Joseph Dunford said the current transgender policy will remain unchanged until Trump sends an official directive to the Pentagon.

Transgender troops have been able to serve openly since the Obama administration lifted the ban in summer 2016. New transgender recruits have not been able to enlist, which was supposed to change on July 1.

Trump's proclamation came while Mattis was on vacation in the Pacific Northwest, and Mattis did not interrupt his time off to make any statement on the announcement.

On the last day of June, Mattis announced he was reviewing the Pentagon's transgender policy after deciding to delay the new enlistment policy for another six months.

House conservatives, though, were frustrated with Mattis, who opposed their efforts to ban Pentagon funding for transition-related medical care. They turned to the White House for help, indicating the issue might prompt them to oppose a wide-ranging spending bill the House eventually passed this week.

A source close to top Pentagon officials said they believe Mattis and Dunford feel "chagrined" with Trump's untimely and unexpected Wednesday announcement.

"The secretary of Defense had a process initiated to determine the goods and the bads" of transgender individuals serving in the military, one of these sources said.

"To have to go through that, and having it ripped out of your hand and being determined by your commander in chief - though he is allowed to do that - I think it frustrated those who have been working on it, as though all that work has been for naught.

"It's like you're just about to announce the second runner up of the beauty pageant and someone runs out and announces the winner. It kind of steals the show."

The first source familiar with the matter said not to read much into Mattis being on vacation when Trump announced the transgender policy, because the timing was clearly tied to the spending bill.

For now, the source said, it's hard to judge where Mattis and Trump's relationship goes from here.

"I would say if this was a normal White House, there would be fallout, but after six months, I think people are pretty much used to the fact that things like this happen," the source said.

Publicly, there will be no friction, said another source familiar with Pentagon bureaucracy.

"You're not going to hear many people in uniform expressing a personal opinion on such a politically charged issue," they said.

Mattis in the past has been dismissive of reports he's clashing with the administration, suggesting they aren't true. For example, asked last week about reports of discord with National Security Adviser H.R. McMaster, Mattis said stories like that make him smile.

"We love reading the news," he told reporters. "We love reading those kinds of stories going - I'm amazed sometimes when I'm having a fight with and everything, somebody I haven't talked to in two weeks. I'm having a fight with them. It's good. You know, it keeps us smiling."

But Jonathan Stevenson, a senior fellow at the International Institute for Strategic Studies and former National Security Council official under former President Obama, said the transgender issue is just the latest sign of "Mattis's inability to establish a truly collegial relationship with the White House."

"Trump clearly made his cynically political announcement about transgender military personnel without meaningfully consulting Secretary Mattis or anyone else at the Pentagon, even though there was a DoD review of the issue pending," Stevenson said in an email. "That was just one more example of Trump's discourtesy towards his cabinet and disregard for interagency coordination."

Trump's critics in Congress have been quick this week to stress the breakdown between Mattis and Trump on the issue.

"So disrespectful to Gen. Mattis," Sen. Claire McCaskill (D-Mo.) said this week. "I mean the height of disrespect to Gen. Mattis. Gen. Mattis had just sent out a memo asking to have until December, and then [Trump] sends out a tweet pretending like the generals told him to do it."

"I think it's outrageous he didn't consult with Gen. Mattis and his commanders before doing this," Sen. Kirsten Gillibrand (D-N.Y.) said on CNN. "In fact, there's an ongoing study that Gen. Mattis had asked for to consult before he made a recommendation to the president."

Sen. John McCain (R-Ariz.), chairman of the Senate Armed Services Committee, also took issue with the White House going around Mattis, as well as Congress. Later in the week, though, McCain said he thinks the White House realizes that was a mistake.

"I think they realize they made a mistake," McCain told CNN. "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."

--This report was updated on Aug. 3 at 6:55 a.m.