Raised voices could be heard through the thick door to the Oval Office as John Kelly - then secretary of Homeland Security - offered some tough talk to President Donald Trump.

Kelly, a whip-cracking retired general who was sworn in as White House chief of staff on Monday, had demanded to speak to the president alone after Trump complained loudly that the U.S. was admitting travelers from countries he viewed as high risk.

Kelly first tried to explain to Trump that the admissions were standard - some people had legitimate reasons to visit the country - but the president insisted that it was making him look bad, according to an administration official familiar with the exchange about a month ago.

Kelly then demanded that other advisers leave the room so he could speak to the president frankly. Trump refused at first, but agreed when Kelly insisted.

It was an early indication that Kelly, a decorated retired Marine general who served three tours in Iraq, is not afraid to stand up to his commander-in-chief.

Tapped to bring order to a chaotic West Wing, Kelly began to make his mark immediately Monday, ousting newly appointed communications director Anthony Scaramucci and revising a dysfunctional command structure that has bred warring factions. From now on, said White House press secretary Sarah Huckabee Sanders, all senior staffers - including the president's son-in-law Jared Kushner and chief strategist Steve Bannon - will report to Kelly instead of the president.

Sanders said Tuesday that Kelly had spent his first day on the job speaking with members of Congress, getting to know White House staffers and working to put new procedures in place.

"It definitely has the fingerprints of a new sheriff in town," said Blain Rethmeier, who guided Kelly through the Senate confirmation process for the Homeland Security post. Rethmeier said that what stood out about Kelly during the time they worked together was the way Kelly commanded respect from everyone he encountered - and the way he respected others.

Kelly drew praise from lawmakers of both parties Tuesday.

Sen. Lindsey Graham, R-S.C., expressed confidence that Kelly can help restore order, saying on NBC's "Today" show that "the Marines have landed at the White House. They have a beachhead."

And Sen. Dick Durbin of Illinois told CNN that Kelly "is in a position where he can stabilize this White House, that's good for this country. The president has to be part of that."

Jason Miller, a senior communications adviser during the Trump presidential campaign, predicted on CNN that Kelly's next move will be to put people in place that will help the president. He suggested Kelly should convince ousted press secretary Sean Spicer to stay on, at least through the tax overhaul effort.

Kelly fostered a reputation as an outspoken commander who didn't shy away from unpopular opinions during his military career. Rethmeier said that Kelly also respects authority deeply - "and that's something that Trump sort of smells out, if you respect him or not."

"If he disagrees with you, he'll disagree respectfully," Rethmeier said.

It was a point Kelly made clear during his confirmation hearing in January.

"I have never had a problem speaking truth to power, and I firmly believe that those in power deserve full candor and my honest assessment and recommendations. I also value people that work for me speaking truth to power," he said.

In April, Kelly bluntly challenged members of Congress critical of the Trump administration's aggressive approach to immigration enforcement to either change the laws or "shut up."

But after being confirmed as part of Trump's Cabinet, Kelly also tried to moderate some of the president's hard-line positions, even as he publicly defended them.

Kelly and Defense Secretary Jim Mattis, another retired general, were also said to have been deeply frustrated with the rollout of Trump's refugee and immigration ban, and made clear to associates that they were not involved in drafting it or aware of its details around the time that Trump signed the original order. Both moved swiftly to address gaps in the measure, with Mattis asking that Iraqis who helped U.S. troops be exempt and Kelly clarifying that green-card holders would not be affected.

Nonetheless, Kelly launched a particularly robust defense of the order to lawmakers and reporters, which was welcomed by the White House.

Mattis and Kelly also agreed in the earliest weeks of Trump's presidency that one of them should remain in the United States at all times to keep tabs on the orders rapidly emerging from the White House, according to a person familiar with the discussions. The official insisted on anonymity in order to discuss the administration's internal dynamics.

Sen. Bob Corker, R-Tenn, said Monday that he discussed Kelly's appointment with Trump and hopes Kelly "will do everything possible to bring the appropriate discipline and focus that needs to be at the White House there."

"I hope that Gen. Kelly will absolutely, forcefully clean the place up," Corker said. "And anybody who's been a violator, who's been a part of public backbiting, part of undermining, who's been part of feathering their own nest at other people's expense, I hope they'll all be gone."

David B. Cohen, a University of Akron political science professor writing a book on chiefs of staff, applauded Kelly for doing "things that should have been done on Day One of Reince Priebus's tenure." He said Scaramucci's removal sent a clear message "that going off-script and being undisciplined" would no longer be tolerated at the White House.

But Cohen wondered how long Trump would go before undermining Kelly.

"President Trump is his own worst enemy," he said. "He instinctively likes to be his own chief of staff and he's a pretty awful one."

Bill Galston, a former Clinton administration domestic policy adviser now at the Brookings Institution, said the ball is now in the president's court to help Kelly succeed.

"If the president is not prepared to accept an orderly policy process with all of the restraints on individual conduct and behavior, then the chief of staff will not have the power to implement policy," he said.