Washington(CNN) President Donald Trump lamented back in 2017 that the appointment of a special counsel would mark the end of his presidency -- and was so furious that he reacted with an expletive, according to the special counsel's redacted report released Thursday.

Trump first learned that Deputy Attorney General Rod Rosenstein appointed Robert Mueller as special counsel from then-Attorney General Jeff Sessions during a meeting to interview candidates for FBI director in May 2017, the report said. Also present were Sessions' chief of staff Jody Hunt and then-White House counsel Don McGahn.

After Sessions delivered the news, "the President slumped back in his chair," the report said, citing notes from Hunt.

"Oh my God. This is terrible. This is the end of my Presidency. I'm fucked," Trump said.

Trump became "angry and lambasted" Sessions for recusing himself from the Russia investigation, according to Hunt's notes.

"How could you let this happen, Jeff?" Trump asked his attorney general.

Trump told Sessions, "'you were supposed to protect me,' or words to that effect," Sessions recalled, the Mueller report stated.

"Everyone tells me if you get one of these independent counsels, it ruins your presidency. It takes years and years and I won't be able to do anything. This is the worst thing that ever happened to me," Trump said, according to the report.

He then told Sessions he should resign, the report said. Sessions agreed, left the Oval Office, and the next day returned to the White House to hand Trump his resignation letter, according to the report.

Trump tucked Sessions' resignation letter in his pocket, but then proceeded to ask Sessions multiple times if he wanted to remain attorney general, the report found.

Sessions said he wished to remain attorney general, but said it was up to Trump, the report said. The President said he wanted Sessions to stay and the meeting ended with the two shaking hands, the report said.

The President kept the resignation letter for nearly two weeks before returning it to Sessions, "with a notation saying 'Not accepted.'" Sessions would continue serving as attorney general for another year, but was ousted in November 2018 by Trump, who remained upset over Sessions' decision to step away from the Russia probe.

Mueller was appointed following the firing of FBI Director James Comey to oversee the federal investigation into Russian interference in the 2016 election, including potential collusion between Trump's campaign associates and Russian officials. Mueller's team also investigated whether Trump obstructed justice.

The investigation could not clear Trump, saying that it was unable to determine that "that no criminal conduct occurred."