WASHINGTON (Reuters) - As fellow Republicans labored to repeal Obamacare this week, U.S. President Donald Trump repeatedly swerved off-topic, escalating concerns in his party about his ability to govern the country six months after taking office.

While senators grappled with healthcare, Trump banned transgender people from the military. He regaled a Boy Scout jamboree with a tale from a New York cocktail party. He indulged an obscene tirade by his flamboyant new communications director.

In the end, the Senate’s efforts collapsed in a predawn vote on Friday, magnifying the ineffectiveness that often goes with the chaos around Trump, the constant storm of tweets, the White House infighting, the self-inflicted wounds.

“We’re seeing clear evidence that all of these distractions are standing in the way of their ability to achieve legislative accomplishments,” said Republican strategist Alice Stewart, a top aide to Senator Ted Cruz’s presidential campaign last year.

In the latest twist, Trump late on Friday named U.S. Homeland Security Secretary John Kelly as his new White House chief of staff, replacing Reince Priebus, who has been in a feud with Trump’s new communications director Anthony Scaramucci.

Among some establishment Republicans, there were signs that patience with Trump was wearing thin.

His national security team, seen as a bedrock of normality, increasingly is frustrated. National Security Adviser H.R. McMaster and Secretary of State Rex Tillerson were described by sources as unhappy with their handling by the White House.

Defense Secretary James Mattis was coming to grips with Trump’s abrupt decision on Wednesday, via a tweet, to ban transgender individuals from military service. The Pentagon said it would not execute the order without more guidance.

Republican strategist Charlie Black said Trump needs to let an investigation of possible ties between Russia and his 2016 campaign run its course and not keep talking about it. Russia denies meddling, and Trump denies any collusion.

U.S. President Donald Trump arrives aboard Air Force One at Joint Base Andrews, Maryland, U.S. July 28, 2017. REUTERS/Jonathan Ernst

The Russia probe has fed public spats with Attorney General Jeff Sessions, quarreling among aides and attacks on Robert Mueller, the special counsel running the investigation.

“He should be talking about policy and sticking to issues for a while,” Black said. “There are still some good things that could get done in Congress like tax reform. He can help further those things if that’s what he talks about.”

FIZZLED EFFORT

In the Senate healthcare fight, Trump phoned Republican senators and urged them to support repeal of Obamacare, but the effort fizzled, a sign there was little political retribution to fear from a president with a sub-40 percent approval rating.

A moderate House Republican said Trump let down the Obamacare rollback effort by not going out and selling a plan. For Trump, a businessman and former reality TV show host, the presidency is his first elected office.

“This issue was outsourced to Congress. It was never really sold. I think that was part of the reason why it was a failure,” said Republican Representative Charlie Dent.

As the Senate fight was coming to a head, Washington was suddenly mesmerized by a profanity-laced rant from Scaramucci, who tore into Priebus and Trump strategist Steve Bannon in an interview in The New Yorker magazine. Stunned aides stopped what they were doing to read the article online.

The rant has so far gone unpunished. Inside the White House, there was a sense of genuine concern and bewilderment about what Scaramucci’s future might portend.

Former White House press secretary Ari Fleischer said the tensions did not seem to trouble Trump.

“The president’s management style seems to be to encourage factionalism among people below him. He seems to place value on watching people fight,” Fleischer said.

Aside from sacking Priebus, it was unclear how Trump planned to proceed to regain his footing.

With healthcare stalled, Trump has his sights set on tax reform with no consensus on how to proceed. Top aides are split on how deeply to cut taxes. It is the same moderates-versus-conservatives split that doomed the Obamacare rollback.