WASHINGTON — As President Trump confronted a torrent of anonymous charges from within his administration over his authority and fitness to govern, he sought validation Thursday from an unlikely source, one of the world’s most infamous autocrats.

“Kim Jong Un of North Korea proclaims ‘unwavering faith in President Trump,’” the president wrote on Twitter early Thursday morning. “Thank you to Chairman Kim. We will get it done together!”

The tweet underscores one of the dangers a chaotic presidency poses to the U.S.: Foreign adversaries can exploit the sense that Trump is being undermined from within. There are echoes of the toughest days of Presidents Nixon and Clinton, when many saw their foreign policy decisions through the lens of domestic scandal.

Trump acknowledged he was at odds with top administration officials even before the New York Times on Wednesday published an anonymous opinion piece from a senior administration official, who said top aides had considered invoking the 25th Amendment to remove Trump from office and had worked to thwart some of his instincts.

Trump described himself as “amazingly alone” in an interview Tuesday with the Daily Caller, a conservative news outlet in Washington, speaking of his efforts to persuade U.S. generals to help him aggressively push allies to spend more on defense.

“A lot of generals don’t understand it. A lot of people don’t understand it,” Trump said. “Amazingly alone. But I’ve gotten many converts over the last period of a year.”

Trump’s comment seemed to recognize a reality widely known but rarely acknowledged publicly: Many on his staff have been conflicted, hoping to both serve and restrain an irascible president in service to the country and, perhaps, out of personal ambition.

A Republican lobbyist with ties to the White House said Secretary of Defense James N. Mattis and John F. Kelly, the chief of staff, view their jobs in the administration as “holding it together.”

“That wasn’t what they thought they’d be doing initially, but it’s how they’ve rationalized their decision to stay in those jobs,” the lobbyist said, speaking on condition of anonymity to reveal administration discussions. “The one common thread is the potential instability of the guy in the Oval [Office]. That’s the problem, and it seems to be a constant.”

That mix of motivations, long an open secret in Washington, gained wider prominence this week as Trump responded angrily to the opinion piece as well as similar revelations in a forthcoming book by journalist Bob Woodward. The book includes accounts of senior staff ignoring Trump’s orders and of former top economic advisor Gary Cohn taking a letter from his desk that would have withdrawn the U.S. from a trade agreement with South Korea, so Trump could not sign it.

Another Woodward assertion — that Mattis ignored Trump’s reported command to assassinate Syrian President Bashar Assad — left senior foreign policy hands especially unnerved.

“We just have to ride out the next two years,” said one senior GOP Senate staffer. “It’s going to be tense times. Democrats will turn Congress into an impeachment clearinghouse, and the president will retaliate.”

Growing suspicions among White House staff, and speculation by the media and the public over who wrote the Times piece, prompted administration denials, including a statement from Vice President Mike Pence’s communications director declaring that Pence did not write “the false, illogical, and gutless op-ed.”

“Our office is above such amateur acts,” Jarrod Agen tweeted. Pence also posted a video of himself speaking reporters in Florida, calling on the author to resign.

Press Secretary Sarah Huckabee Sanders tweeted the New York Times’ phone number, urging followers to call and request the “identity of the gutless coward.”

Foreign leaders had already viewed Trump’s leadership with confusion and sometimes concern, according to foreign diplomats, policy analysts and officials from prior administrations, who have long noted the frequent disconnect between Trump’s rhetoric and his administration’s actions.

Assertions that he is being actively undermined have only intensified the White House reputation for tumult and palace intrigue, said Mara Karlin, who worked for five secretaries of Defense under Presidents George W. Bush and Obama.

People “should not delude themselves into thinking that our frenemies and adversaries aren’t trying to take advantage of this chaos and dysfunctionality,” Karlin said. She noted that Secretary of State Michael R. Pompeo, Mattis and Joseph Dunford, chairman of the Joint Chiefs of Staff, arrived in New Delhi on Thursday for a strategy summit with India. “You have to assume they’re being pretty heavily distracted,” she said.

Domestic controversies also open up presidents to questions about foreign policy motivations, complicating responses to crises. In 2000, near the end of a second term marred by scandal and impeachment, Clinton did not respond forcefully to the attack on the Navy destroyer Cole, despite intelligence that Osama bin Laden was behind it.

Historian Michael Beschloss points to Nixon’s fruitless effort to negotiate arms control with the Soviets in 1974, during Watergate. The Soviets, he said, “basically kept the meter running and didn’t do anything.”

“[Then-Secretary of State Henry] Kissinger later wrote that the Soviets treated Nixon with the solicitude they would devote to someone who is terminally ill,” Beschloss said. “Trump is not at that point, but it’s always a consideration for foreign leaders. If another leader is negotiating with Trump, they have to factor in that he may lose the House and even have a smaller chance of lasting a full term.”

Woodward’s book says one foreign leader expressed concerns in July 2017 about the cloud of investigations over Trump. “Donald, I’m worried about this investigation. Are you going to be around?” Egyptian President Abdel Fattah Sisi reportedly asked.

Jim Hanson, a Trump ally and president of the Security Studies Group think tank, calls the “Trump-as-toddler theme” overblown. He concedes that adversaries may seek to exploit the perception of instability, but says, “I think it’s undermined by the fact that his administration is much more effective than it’s given credit for.” He pointed to the tough reputations of Pompeo and national security advisor John Bolton.

Trump’s popularity with Republicans and his administration’s achievements on party priorities, including tax cuts, the rollback of regulations and the appointment of a record number of conservative federal judges, have helped him keep most GOP lawmakers from leaving him.

Republicans, one GOP Senate chief of staff said, “privately say they don’t like Trump, but most love his policies and they’ve decided that that’s more important than their concerns about his behavior.”

But after the last two weeks, the aide said, that calculation is being reconsidered: “It’s possible that at some point more Republicans start saying these policies aren’t worth it.”

noah.bierman @latimes.com

eli.stokols@latimes.com