When other presidents were dealt the kind of jolting setback that President Trump received from the courts this week, they learned from those moments to alter their approaches to the job.
Trump, however, has a history of stubbornness and a self-proclaimed mission to upend almost everything his predecessors have done. That could color how he confronts the new limits on his power as he tries to make the kind of sweeping change he expected to deliver on his own.
Signs of struggle inside the White House have emerged between those who want Trump to keep his hyper-aggressive style and those who would like to see him seek more consensus.
So far, those who like new policies to land with the clatter of breaking glass have had the most sway. But Thursday's ruling that blocked Trump from suspending the country's refugee program and travel from seven Muslim-majority countries capped a week that saw his authority under assault on several new fronts.
Utah Rep. Jason Chaffetz, a Republican who leads the House oversight committee, joined Democrats in calling for an ethics rebuke against senior White House counselor Kellyanne Conway, who promoted the fashion line of Trump's daughter during a televised interview from the White House.
National Security Advisor Michael Flynn discussed U.S. sanctions with a Russian diplomat during the transition, when President Obama was still in office, the Washington Post and others reported, despite prior denials from Flynn and Trump administration officials. The discussions were viewed by experts as inappropriate and perhaps illegal, given the timing.
And Trump, in what many saw as weakness on the foreign stage, publicly acceded to Chinese President Xi Jinping's demand that he reaffirm the "one China" policy that Trump flouted during the transition when he took a congratulatory call from Taiwan.
Despite historically low popularity ratings and an outward sense of tumult, Trump and those inside the administration continued to express confidence, shaded with defiance, blaming the news media for distorting a fast-moving period that has been popular among Trump's core supporters.
"When you look at the totality — we've issued 25, plus or minus, executive actions, nominated a Supreme Court justice," said Sean Spicer, the White House press secretary, in an interview. "When people actually take the time to look at what has happened, it is a pretty amazing first 21 days, amazing and successful 21 days."
There are indications that Trump's team is making adjustments on the fly. After the legal setbacks on his travel ban, senior advisors huddled to brainstorm alternate paths that might accomplish similar goals without a drawn-out court battle.
On Friday, they scrambled over a plan to issue new, more narrowly tailored travel restrictions while they considered whether and how to pursue appeals. While Trump was speaking publicly about his next steps aboard Air Force One on Friday afternoon, top policy and communications advisors back at the White House were still debating how far they should take the appellate process.
Presidents eventually figure out they need to shift power away from campaign aides who helped them win election in favor of the experts in government who can craft policy and manage the bureaucracy more effectively, said Elaine Kamarck, a former aide in the Clinton White House who writes about the office of the presidency.
"What he's now seeing is that a court order actually stops executive action," she said of Trump. "It doesn't matter what he says or what he tweets."
She compared the courts' slapdown of Trump's travel bans to a shock Clinton faced early in his presidency, when he bungled an attempt to fulfill a campaign promise to allow gays to serve openly in the military.
"It was a failure to consult with the government before taking action," she said.
Clinton's advisors urged him to pick his political battles more selectively and seek more input from those who had spent careers navigating the federal government.
Trump has shown hints that he is willing to accept advice, especially as members of his Cabinet win congressional approval and begin offering it. And though he does not sound humbled, Trump has allowed that the stakes are greater than others could grasp.
"I've learned tremendous things that you could only learn, frankly, if you were in a certain position, namely president," he said Friday during a news conference while speaking about the threat of terrorism.
Kamarck saw Trump's outreach to China as evidence that he is willing to defer to experts and curb some of his more provocative behavior. Yet hours after he moderated on China, Trump refreshed his attack on the judiciary in unusually personal terms that broke presidential norms, calling the appeals court ruling "disgraceful" on Twitter.
The dual signals match divisions within Trump's inner circle.
One side is led by nationalist ideologues including Stephen Bannon, the former publisher of the far-right Breitbart News website who serves as Trump's chief strategist. The more traditional conservative side is led by Reince Priebus, former chairman of the Republican National Committee who is Trump's chief of staff.
Bannon had a strong hand in drafting the overturned immigration order that was issued with little input from others only a week into Trump's presidency. Though it was temporarily blocked by the appeals court, Trump and his aides said they would keep fighting for the goal.
One Trump aide, who requested anonymity to reveal internal deliberations, insisted the administration would wage a stronger fight with help from the new secretary of State, Rex Tillerson, and the new attorney general, Jeff Sessions. The official said that Trump's executive action — framed by the president as a matter of security — is a better issue to debate than fending off attacks over ethics relating to Trump's family businesses or about Flynn's contacts with Russia.
Trump's advisors who pushed for the ban said they were not deterred by Thursday's court decision by the 9th Circuit Court of Appeals, which some expected to lose. The court, in their view, is stacked with liberal, activist judges who want to act in solidarity with the judicial branch. One of the three judges who sided against them was appointed by President George W. Bush.
If they chose to continue the court fight, they believe the courts will uphold the basic intent of the order, which is to stop people from entering the U.S. who might pose a risk. Even if they prevailed in court, though, it could take months, effectively stalling their agenda.
Those crafting Trump's immigration policies share a broader, long-term goal of shrinking the foreign-born population in the U.S. and transforming the immigrant makeup of the country by limiting the number of people coming to the country who, in their view, won't assimilate.
The Trump administration "is under no obligation to admit any particular person and we have a right to develop a system in which we're selecting immigrants that we think will be able to make positive contributions to U.S. society," a senior administration official told reporters in the White House two days after the travel ban order was signed.
Despite aides' confidence, one longtime Trump associate, the political consultant Roger Stone, said Trump is deeply worried about a string of leaks to the media — including a report depicting the president as wandering the White House at night in a bathrobe and others suggesting he is naive.
"He's unhappy about the leaks," Stone said.
Stone, a provocateur in his own right, said Trump has a loyalty problem in that the White House is stocked with people who were not early campaign supporters. He named only three people — Bannon, Conway and policy director Stephen Miller — as loyalists, and Conway was allied with rival Ted Cruz before joining Trump's campaign last summer.
"He needs to make some wholesale changes," said Stone, who has given Trump political advice for decades.
Stone attacked Priebus for, in his view, spending too much time with Trump and not enough time running daily White House operations.
A White House official said Trump does not speak with Stone.
Trump's court setback emboldened Democrats, who are still seeking a way to emerge from a devastating election that saw them surrender complete control to the GOP.
"It's a major, major, major defeat for this administration in just the [first] few weeks," said Rep. Joe Crowley (D-N.Y.), the No. 4 House Democrat. He promised more resistance "because they'll continue to overstep."
Trump may also face new friction from Republican members of Congress. Several conservatives faced hostile crowds Thursday night as they held town meetings with constituents, most notably Chaffetz, whose district is one of the most conservative in the country. Many demanded more oversight of Trump.
Still, even as Trump's busy presidency has already generated enough news for a lifetime, it is early. And many Republicans who weathered the tumult of his presidential campaign are equipped to deal with further stumbles.
They point to the loyalty of Trump's strongest supporters, who believe that most of the resistance he faces is a byproduct of his willingness to shake up the status quo. And they view public demonstrations against the new administration skeptically, believing most are the work of organized Democratic special interest groups.
The real test for Trump, Republicans believe, will come when he begins negotiating with Congress on the tax code, healthcare and the size of the federal budget. Trump himself has been in touch with House Speaker Paul D. Ryan (R-Wis.) and Senate Majority Leader Mitch McConnell (R-Ky.) regularly, if not daily. McConnell met with Trump in the Oval Office on Friday.
As Trump and his administration have wobbled, Republicans leaders have proceeded cautiously — in some cases gently distancing themselves from controversy, in other cases avoiding it altogether. They are laying the groundwork for moving their shared agenda forward in Congress, and in the case of the Senate, working to confirm the remaining members of the president's Cabinet and preparing to consider his Supreme Court nominee, Neil Gorsuch.
"They've seen this movie for six months. They've had to answer for it for six months," said one Republican strategist, requesting anonymity to share thinking of senior Washington Republicans. "I really don't get the sense that there's a panic button in the near future."
Staff writers Lisa Mascaro and Michael A. Memoli contributed to this report.