Just outside the spacious corner office of the White House national security adviser, aides crowded into a windowless anteroom knew to make themselves small when John Bolton got a summons from President Trump. Bolton, his ubiquitous yellow legal pad in hand, would throw open his door and set off at a gallop.

Once in the Oval Office, Bolton would take copious notes on that pad, at times angering a president known to mistrust note-taking by even his closest aides, according to a former senior administration official.

Leaks from Bolton’s soon-to-be-published memoir, in which he alleges a direct link between Trump’s withholding of aid to Ukraine and his desire that its government investigate his political rivals, validated the president’s suspicions in the eyes of some senior White House officials.

Bolton, who left the White House in September — Trump said he was fired; Bolton said he resigned — did not respond to a question about whether he had used personal notes or official documents in his book.

The manuscript includes more than a dozen pages on Bolton’s interactions over Ukraine with Trump, his personal attorney Rudolph W. Giuliani, Secretary of State Mike Pompeo and others, according to one person familiar with the project. In what this person called an “unflattering” portrait of the president, it also touches on other areas where Bolton is known to have disagreed with Trump policy decisions, including Venezuela and Turkey.

But another former senior official, one of several who spoke on the condition of anonymity to discuss internal matters, said Bolton “didn’t need to have” documents or his own notes from inside the White House, “since he probably went home every night and wrote about it.”

Noting the rapid completion of Bolton’s book, “I’m convinced he was writing all the time” he served as national security adviser, said this former official, who described Bolton as a nose-to-the-grindstone person who rarely socialized.

The weekend revelations landed like a bombshell in the ongoing Senate impeachment trial over the Ukraine matter, where key Republican lawmakers on Monday indicated they may defy the GOP leadership to support calling Bolton and other witnesses.

People close to Bolton said he wanted to testify, and a spokeswoman denied that he was behind the leak of the book, adding that the National Security Council has had a copy of it since Dec. 30.

Bolton was regularly appalled by what he saw from the president, the people close to him said. He wondered at times if Trump was acting in America’s best interest or if he was inspired by nefarious reasons, according to a person familiar with the book.

But among conservative national security experts and media, the focus was less on the accuracy of Bolton’s account, or its possible effect on the trial, and more on why he wrote it.

“If he wants to write a book like this, it should come out after the election,” Fred Fleitz said in an interview. Fleitz was the National Security Council’s chief of staff for part of Bolton’s 17-month White House tenure and a Bolton associate for decades.

“It’s natural occasionally for presidential advisers to have a falling out,” said Fleitz, referring to Bolton’s departure. “It’s appropriate for the adviser to move on.”

In an opinion column on the Fox News website, Fleitz said he failed to see the need for “a former national security adviser to publish a tell-all book critical of a president he served,” especially in the midst of a campaign “that will determine the fate of the country.”

He called on Bolton to withdraw the book — titled “The Room Where It Happened: A White House Memoir” — until after the election.

Others were more direct. “Bolton has sadly reduced himself to nothing more than an unprincipled tool of the Radical Dems and Deep State: And he’s sacrificed his integrity to sell a lousy spiteful book, pathetic,” Fox host Lou Dobbs wrote on Twitter about a man who had long been a regular on Dobbs’s show.

Giuliani, in a message to The Washington Post, called Bolton a “backstabber” and said he regretted recommending him to Trump.

Trump, he said, “never really trusted the Backstabber’s judgment. He was right and I was wrong because ironically I supported him for the job.”

White House officials and Trump advisers cast Bolton as a pugnacious figure disliked by many of his colleagues — contemporaneous accounts supported that — who was simply looking for a payday.

“How convenient that this leaked info happened to be released at the same time as preorders were made available for the book on Amazon,” Steve Guest, a spokesman for the Republican National Committee, said on Twitter. “What a joke.”

Bolton’s lawyer, Charles Cooper, denied in an interview that he or his client had anything to do with the leaked portions of the book, first published Sunday by the New York Times. “I can tell you unequivocally that we had nothing to do with the leak of any information concerning John’s manuscript,” Cooper said.

Mark Dubowitz, chief executive of the Foundation for Defense of Democracies, defended Bolton and bemoaned that “in the demonization campaign” against him, “many forget that at the end of the day he was and remains a deeply experienced policy practitioner, with decades of experience over multiple administrations.”

Calling Bolton a “deeply principled person who . . . has a deep respect for American law and for the Constitution,” Dubowitz said he was certain Bolton was “not doing this to sell books and not doing this to get revenge because he was fired by the president.”

Dubowitz also said he was “super torn.”

“I’m not a big fan of these tell-all books. . . . I wonder how good it is for our country when presidents are always going to be looking over their shoulders and behind their backs,” he said.

Another foreign policy expert on the right, who considers himself a friend of Bolton and an admirer of Trump, said he was surprised Bolton took the White House job in the first place.

“When he was announced, I thought, ‘Oh, my God, this is never going to work.’ The reason is that it’s very clear that Bolton and Trump have very different ideas on how foreign policy should be run.”

Bolton, this expert said, is “an offensive realist” who thinks you “use power to get power.” Trump, on the other hand, is a “defensive realist” who “thinks power is a wasting asset . . . that you only use when you really need to.

“They did work very well on a lot of issues. Then the relationship just kind of broke down. . . . There was clearly a personal animosity there at the end.”

Tom Hamburger contributed to this report.