For all President Trump has done to try to discredit the work of special counsel Robert S. Mueller III, the Russia investigation nevertheless became the ominous elevator music of his presidency — ever-present, always thrumming, invariably haunting.

Trump’s attacks on the wide-ranging federal inquiry of Russian interference in the 2016 White House race — and possible links to his campaign — have been so brazen that his actions themselves became a subject of the probe

“This has been a Damocles sword hanging over Trump’s head since virtually Day One in the White House,” historian Douglas Brinkley said of the investigation, which began in May 2017.

Yet despite the potential peril, behind the scenes Trump and his team had made limited preparations in the run-up to Friday, when Mueller finally delivered his much-anticipated report to Attorney General William P. Barr.

They had not coordinated an aggressive response machine, as President Bill Clinton’s aides did ahead of independent counsel Kenneth Starr’s 1998 report about Clinton’s relationship with White House intern Monica S. Lewinsky. Surrogates were not mobilized in advance. Talking points were not distributed. A report was prepared to counter Mueller’s findings — but there is internal debate about whether to release it.

“We’re really just waiting,” Rudolph W. Giuliani, one of Trump’s personal lawyers, said in an interview earlier this month. “There’s nothing more we can do.” 

On Friday, Giuliani said he and the president spoke in the morning, before Trump departed to spend the weekend at his private Mar-a-Lago resort in Florida, to discuss how to deal with the special counsel’s findings.

“He has become sort of tired of it,” Giuliani said. “His view is that it’s going to happen one day, and we’ll be ready.”

Some in Trump’s orbit privately griped that the absence of a detailed plan was business as usual for an administration that pings from crisis to crisis. Others noted that Trump’s advisers and lawyers were operating at a disadvantage: They, like the rest of the nation, do not know what the report says — and until Friday, did not have a sense of when it would land. 

“Everybody is just waiting for the contents,” said Rep. Mark Meadows (R-N.C.), a Trump confidant. “It’s hard to know what to push back on or what not to push back on.”

Trump’s aides said the White House, the president’s reelection campaign and the Republican National Committee have held informal conversations about how to respond to the Mueller report. They are discussing possible outcomes, from a worst-case scenario — the special counsel outlines criminal conduct by the president — to the best-case scenario of total exoneration. 

But as with most of this administration’s crises, aides said, the response will largely be driven by the president — who, over and over again, has lashed out angrily at Mueller.

Trump called the investigation a hoax, denounced it as a “witch hunt” (at least 183 times on Twitter) and turned “no collusion” into a defiant mantra. 

“The Mueller investigation is totally conflicted, illegal and rigged!” Trump tweeted last month in one typical post.

Better 'when I'm on offense'

Soon after his appointment, Mueller began examining whether the president obstructed justice.

Among the episodes the special counsel team scrutinized was the one that precipitated Mueller’s appointment: Trump’s firing of James B. Comey as FBI director in May 2017. At the time, White House aides said he had dismissed Comey at the urging of senior Justice Department officials. Trump tweeted that Comey had “lost the confidence of almost everyone in Washington, Republican and Democrat alike.”

But Comey later told Congress that Trump had earlier asked him to pledge his loyalty to the president and drop an investigation of former national security adviser Michael T. Flynn. Trump denied that, saying he did not ask Comey to ease up on his investigation of Flynn.

Within eight days of Comey’s firing, Deputy Attorney General Rod J. Rosenstein appointed Mueller to serve as a special counsel and take over the FBI’s investigation of Russian interference.

Trump initially held a relatively conciliatory posture toward the inquiry — urged by his then-personal lawyer John Dowd and then-White House lawyer Ty Cobb to cooperate and refrain from attacking Mueller. They argued that the Justice Department’s opinion that a sitting president could not be charged with a crime was definitive, and their strategy was designed to reduce the chances of a compulsory presidential interview.

But Mueller’s investigation stretched on, leading to indictments of Trump’s former campaign chairman and national security adviser, among others, and a detailed airing of Russia’s interference in the 2016 campaign.

Trump’s actions were put in the spotlight, including when The Washington Post reported that he personally dictated a misleading statement that his eldest son, Donald Trump Jr., initially provided about a meeting in June 2016 at Trump Tower in New York with a Russian lawyer. Trump Jr. had accepted the meeting after being promised damaging information about Hillary Clinton, a Democratic presidential rival.

As Mueller’s inquiry intensified, Trump kept telling his lawyers he wanted to take a more aggressive stance.

“I’m better when I’m on offense,” he said in a 2018 meeting, according to someone with knowledge of the conversation who spoke on the condition of anonymity to describe internal discussions. “Are we going to just let them f--- us forever?”

Trump asked aides about his power to pardon those caught up in the Russia investigation, including his family members — and tweeted that he has “the absolute right to PARDON myself.” His lawyers, too, floated the president’s potential openness to pardoning former aides and advisers facing criminal charges as part of the inquiry.

And the president grew livid that Attorney General Jeff Sessions had recused himself from the investigation and began publicly and privately berating Sessions. The beleaguered law enforcement chief was finally ousted the day after the November midterm election. 

The president also attacked Rosenstein as a member of the “deep state,” suggesting that he was part of a cabal of bureaucrats out to undermine him, and considered removing him at various times, according to people familiar with his views. And Trump sought the firing of Mueller, although he backed off after facing resistance from the White House counsel’s office.

Giuliani told The Post that Trump’s public comments about Justice Department officials “really amount to him defending himself, not threatening anybody — you have to have some element of coercion to have obstruction.”

And Giuliani said that reports that Trump considered firing Mueller and Sessions in 2017 to thwart the investigation did not matter, because Trump did not fire Mueller — and fired Sessions only as the work was concluding. 

An unexpected nonchalance

In recent weeks, Trump has asked aides what — if anything — they’d heard about Mueller’s report and when he planned to submit it to Barr. Publicly, he has delivered a steady stream of tweets decrying the investigation as a “Witch Hunt Hoax” and insisting that he had nothing to fear because, as he repeatedly put it, there was “no collusion” with Russia.

“There should be no Mueller Report,” Trump wrote in a tweet last Friday, adding, “Russian Collusion was nothing more than an excuse by the Democrats for losing an Election that they thought they were going to win.”

He also has attacked the late senator John McCain (R-Ariz.), repeatedly lashing out at him on Twitter throughout the past week. Aides said Trump’s anger was fueled by a news report about McCain’s decision to give the FBI a copy of a dossier about Russia’s support for Trump after the 2016 election.

Despite the president’s public fulminations, inside the cramped offices of the West Wing, aides have exhibited an unexpected nonchalance about the impending finalization of the Mueller inquiry. There were no all-hands-on-deck meetings to game out the report, according to administration officials and advisers. One Republican strategist in frequent contact with the White House described the coming report as a “fait accompli,” noting that the Trump team is now well-accustomed to scrambling to respond to crises with little preparation.

Still, White House officials said that the president’s lawyers had planned for various scenarios and drafted potential responses to be used in a public relations offensive after the report is released. 

As one senior administration official who spoke on the condition of anonymity to describe internal planning put it, “We know what we did and didn’t do.”

Giuliani said the president’s team thinks there is only a “remote” chance that Mueller will argue that there was any collusion between Trump associates and Russia. He anticipates that the report will be succinct. 

“If I had to bet right now, they’re going to put out something short,” Giuliani said, adding that the Trump team’s response will be brief, as well. “We’ll put out something short, if anything.”

Giuliani had long promised to issue a “counter report” in which the president’s team would challenge Mueller’s findings. But some of Trump’s advisers in the White House discouraged that idea, arguing that it is far too risky to distribute long written explanations of such sensitive topics as the Comey firing.

Before Friday’s news, Giuliani said the legal team was waiting to determine how much of the counter report to release. 

“We’ve prepared what I would call an all-contingencies report. Just assume the worst — and let’s answer it all,” Giuliani said. “Let’s say they say ‘no collusion, no obstruction.’ I don’t think we’d issue a report. What are we going to do, disagree with them? It’s very hard to say what we are going to do until we see what they’re going to do.”

Giuliani said Trump’s attorneys have responses prepared for some of the most controversial issues they think the special counsel report may address, particularly whether the president obstructed justice.

On that point, Giuliani said, they plan to cite a memo Barr wrote to Rosenstein last year questioning Mueller’s investigation. He said they also have prepared a list of reasons Comey was fired.

Those who have worked with the president predict that he will declare victory and show no contrition, regardless of what Mueller’s report concludes.

“My guess is he’ll spike the football and say ‘I told you so’ on collusion,” said Cliff Sims, a former White House aide and author of the book “Team of Vipers,” about his time working for Trump.

Sims added that if the report finds no conspiracy between Trump and Russia, the president probably will dismiss any other unflattering portrayals by Mueller as “a desperate attempt” by the media and Democrats “to make me look bad.”

A former senior White House official said that he never heard Trump admit wrongdoing, even in private, and that the president always adopted a posture of defiance. Trump took pride in the fact that his attacks on Mueller had weakened the standing of the revered former Marine and ex-FBI director in the court of public opinion, confidants said, and bragged that half the country would never believe Mueller — no matter what. 

Now, Trump’s allies say, the president will be assessing the special counsel report through the prism of his 2020 campaign. If the report clears the president of wrongdoing, he could try to use it to undercut the burgeoning congressional investigations and rally his base, they said.

“He’ll play himself as the victim who won, and he’ll just try to use this for political gain,” said Sam Nunberg, a former Trump campaign official. “All that matters now will be how this thing affects his reelection.”

Rosalind S. Helderman and Robert Costa contributed to this report.