President Trump has routinely asserted his outsize view of presidential power, but his claim to unprecedented clout in recent weeks springs from an unlikely source: one of his defeats at the Supreme Court.

Trump has asserted that with the stroke of a pen he can break through gridlock on immigration, health care, the stalemate on relief for those hurt economically by the coronavirus pandemic, even mail-in balloting.

“The Supreme Court gave the president of the United States powers that nobody thought the president had,” Trump told Fox News interviewer Chris Wallace on July 19.

On Wednesday, he said he might employ them on the payroll tax. “I have the right to suspend it, and I may do it myself. I have the absolute right,” the president said on “Fox & Friends,” reviving an idea he floated months ago but which has faced opposition from Republicans and Democrats alike.

Trump had promised Wallace an “exciting two weeks,” but so far it’s been all executive talk and no executive action.

The source of Trump’s recent bravado appears to be provocative articles by a law professor at the University of California at Berkeley whose expansive views of presidential power match Trump’s.

John Yoo, the professor, has proclaimed Chief Justice John G. Roberts Jr.’s opinion stopping the Trump administration from dismantling the Obama-era program protecting young undocumented immigrants a blessing in disguise. He contends that it allows presidents to take even unlawful actions that can require years of legal battles to undo.

To say that Yoo’s view of the court’s 5-to-4 decision on the Deferred Action for Childhood Arrivals program is an outlier would be an understatement.

“I think he must be on some kind of drug,” said Laurence Tribe, a longtime constitutional scholar at Harvard. The court’s decision “did not even remotely provide a blueprint for the kind of lawlessness John Yoo seems to be trying to convince this president” to undertake, Tribe said.

The Supreme Court’s decision was seen by most analysts as a check on presidential power. It said that the administration must show it considered the consequences of undoing a program on which 700,000 “dreamers” had come to rely, and that the Department of Homeland Security’s decision to end it because of its purported unlawfulness was inadequate under the Administrative Procedure Act.

Leah Litman, a constitutional law professor at the University of Michigan, said the Trump administration’s tendency to cut corners on such legal requirements has had consequences.

“The administration has a horrendous track record in the Supreme Court and in the lower federal courts in cases involving the Administrative Procedure Act, which requires the administration to give reasonable arguments and legitimate explanations for its policy choices,” Litman said.

“Yoo’s argument is based on a misunderstanding of the DACA policy, and an even worse misunderstanding of the Supreme Court’s decision in the DACA case,” she said. “Neither would stand up in court under any kind of scrutiny.”

It is hard at times to separate the vehemence of opposition to Yoo’s views from personal objections to Yoo himself. He will always be known in Washington as author of the “torture memos,” which condoned tactics such as severe sleep deprivation and waterboarding for terrorism suspects taken into custody during the George W. Bush administration — measures later renounced.

“That the administration plans to use John Yoo’s tortured (yes that’s intentional) arguments is a pretty good indication of why this administration frequently loses in court on administrative law,” Litman wrote in an email.

Yoo met with the president last week in the Oval Office, to discuss the theory and a new book he has written. “Defender in Chief: Donald Trump’s Fight For Presidential Power” makes the case for an “energetic unitary executive” with constitutional authority to act decisively and resist overreach by Congress and the courts.

Yoo told The Washington Post that Trump asked about his articles. Because the Supreme Court majority said then-President Barack Obama’s decision to not enforce certain immigration laws could not be quickly undone without satisfying the APA, Yoo argues, presidents have sweeping authority to take all sorts of actions — even legally questionable ones — and keep them in place for years while legal battles slowly proceed.

“If you can choose not to enforce the immigration laws, here are the other things you could not enforce — such as not collecting taxes because we’re in the middle of this Great Depression,” Yoo said he told the president, summarizing his arguments in Newsweek and the National Review.

“We talked about the article and what it said, but I don’t want to say anything about what potentially they want to apply it to. They have the right to ask people for advice confidentially,” Yoo said.

One White House official, speaking on the condition of anonymity to detail internal discussions, cautioned against the implication that the administration would use Yoo’s theory in advancing the executive actions the president has said he is planning, and played down the significance of the professor’s Oval Office visit.

The president hardly needs encouragement to act unilaterally. One of his first directives in office was a ban on entry to the United States by citizens of several majority-Muslim countries, which went through three editions before being approved by the Supreme Court. His administration has moved aggressively on other issues, such as changing asylum rules and declaring a national emergency to shift money from the Pentagon to fund construction of a southern border wall.

Yoo’s articles said there was no reason to stop there. In the National Review article, Yoo theorized that Trump could create a national right to openly carry weapons.

“Even if Trump knew that his scheme lacked legal authority, he could get away with it for the length of his presidency,” Yoo wrote. “And, moreover, even if courts declared the permit illegal, his successor would have to keep enforcing the program for another year or two.”

That is “essentially” what happened in Department of Homeland Security v. Regents of the University of California, Yoo wrote.

Michael W. McConnell, the director of the Constitutional Law Center at Stanford Law School, said he considered Yoo’s pieces more of a “tongue-in-cheek critique” of Roberts’s reasoning than a blueprint for presidential action.

Trump has done a 180-degree turn on the issue. He initially tweeted that it and other “horrible” decisions by the court were “shotgun blasts into the face of people that are proud to call themselves Republicans or Conservatives.”

But in the days afterward, the president said the decision required him only to fill out “paperwork” to get the plan to end DACA back on track. Since then, he has declared the ruling a boon.

Most, though, see the decision as of a piece with a previous ruling by Roberts, also joined by liberal Justices Ruth Bader Ginsburg, Stephen G. Breyer, Sonia Sotomayor and Elena Kagan, that the administration had not properly complied with law in trying to attach a citizenship question to the 2020 Census.

David Cole is legal director of the American Civil Liberties Union, which has clashed repeatedly with the president’s desire to expand executive discretion. He said it was clear the Regents decision limited executive action.

“The case did not question whether Trump had the authority to rescind DACA, it challenged only the way he did it,” Cole said. “And the court found he did it illegally.”

The court’s four most consistent conservatives dissented. But Justice Brett M. Kavanaugh, one of Trump’s two nominees to the bench, wrote that “all nine members of the court accept, as do the DACA plaintiffs themselves, that the executive branch possesses the legal authority to rescind DACA and to resume pre-DACA enforcement of the immigration laws enacted by Congress.”

Justice Clarence Thomas’s dissent, joined by Justices Samuel A. Alito Jr. and Trump appointee Neil M. Gorsuch, provides some support for Yoo’s theory. Under the majority’s rule, Thomas wrote, there could be “perverse incentives” for outgoing administrations to make questionable policy decisions it would be hard for the next administration to reverse.

“Even if the agency lacked authority to effectuate the changes, the changes cannot be undone by the same agency in a successor administration unless the successor provides sufficient policy justifications to the satisfaction of this court,” Thomas wrote. “In other words, the majority erroneously holds that the agency is not only permitted, but required, to continue administering unlawful programs that it inherited from a previous administration.”

Other legal scholars have made a similar point. Zachary Price, a professor at UC Hastings Law School in San Francisco, said the decision “may carry implications that progressives will regret.”

Writing in SCOTUSblog, Price said the Trump administration “might use its remaining time in office to adopt permissive enforcement policies across any number of areas, from gun control to labor regulation, the environment and public corruption.” A new administration would be foreclosed from changing them without meeting the court’s standards.

But Price doesn’t think that is likely. Roberts and the liberals, he said, seemed to have created a decision so narrow that it “seems deliberately designed for one day and case only.”

Cole said the real lesson of the decision is “what is done by unilateral executive order can be undone by unilateral executive order — so the real check on President Trump will be the November election.”

Carol D. Leonnig, Jeff Stein, John Wagner and Matt Zapotosky contributed to this report.