(CNN) Former chief of staff Reince Priebus revealed that he helped persuade President Donald Trump not to fire his attorney general last year in the wake of a special counsel being appointed to investigate ties between his campaign and Russia.

Priebus, who served in the White House for six months, details for the first time the moment when Jeff Sessions was prepared to resign last May in a forthcoming book, "The Gatekeepers: How the White House Chiefs of Staff Define Every Presidency," by Chris Whipple.

During an Oval Office meeting in May, eight days after firing FBI Director James Comey, Trump called Sessions an "idiot" and blamed the appointment of a special counsel on Sessions' choice to recuse himself from the Justice Department's Russia investigation, The New York Times reported.

In the excerpt, Whipple writes that Priebus said he had been filled in on that meeting by White House counsel Don McGahn, who told him that Sessions had decided to resign after his encounter with Trump.

"'I said, 'What!? What the hell are you talking about?' " Priebus recalled to Whipple during an interview last October, "I said, 'That can't happen.' "

Priebus tells Whipple that he dashed from his office and out to the West Wing parking lot to stop Sessions before he left the White House premises. He found Sessions in the back seat of a black sedan, with the engine running.

"I knocked on the door of the car, and Jeff was sitting there and I just jumped in and shut the door," Priebus said, according to the excerpt. "And I said, 'Jeff, what's going on?' And then he told me that he was going to resign. I said, 'You cannot resign. It's not possible. We are going to talk about this right now.' So I dragged him back up to my office from the car."

Along with Vice President Mike Pence and then-White House chief strategist Steve Bannon, Priebus said, he tried convincing Sessions not to resign. However, the attorney general offered his resignation letter later that night. Priebus then claimed that he convinced Trump to return the letter and reject Sessions' resignation.

But in June, Trump pushed for Priebus to obtain Sessions' resignation "flat out," according to a White House insider cited in the excerpt.

According to the insider, Priebus again intervened, warning Trump, " 'If I get this resignation, you are in for a spiral of calamity that makes Comey look like a picnic,' " referring to the former FBI director's firing.

Although he was successful in talking Trump out of firing his top Justice Department official, Priebus revealed that his efforts to rein in Trump's social media posts were futile.

"Everybody tried at different times to cool down the Twitter habit -- but no one could do it. ... After (last year's) joint session (of Congress) we all talked to him, and (first lady) Melania said, 'No tweeting.' And he said, 'O.K. -- for the next few days.' We had many discussions involving this issue. We had meetings in the residence."

"I couldn't stop it," Priebus said in the excerpt.

Priebus, a former Republican National Committee chair, acknowledged that the idea that Trump "was suddenly going to accept an immediate and elaborate staff structure regulating every minute of his life was never in the cards."

Priebus also said he didn't want to pick a fight with the President on his first day, when Trump was upset over the size of the crowd at his inauguration.

"Am I going to go to war over this with the president of the United States?" Priebus recalled thinking to himself.

The hiring of Anthony Scaramucci as communications director, who only lasted 10 days, however, seemed to be the last straw.

"When he accused me of a felony, I thought, 'What am I doing here?' ... I went in to the President and said, 'I gotta go,' " said Priebus, who offered his resignation to Trump in July 2017.

During his short tenure, Priebus struggled to bring order to a chaotic White House with a staff of differing personalities and ideologies.

"Take everything you've heard and multiply it by 50," Priebus said about the internal conflict, Whipple reported.

As for how the chaos affects Trump, Priebus said, "(Trump) doesn't mind the craziness, the drama, or the difficulty, as long as an end goal is in sight. He will endure it."

The day after Priebus offered his resignation, Trump announced on Twitter that his homeland security secretary, John Kelly, would immediately replace Priebus as chief of staff.

Despite all he's been through with Trump, Priebus said he is still in contact with the President, who often calls him to chat or seek advice.

"I still love the guy. I want him to be successful," Priebus said.