John Bolton, the former national security adviser, says in his new book that the House in its impeachment inquiry should have investigated President Donald Trump not just for pressuring Ukraine to incriminate his domestic foes but for a variety of instances when he sought to intervene in law enforcement matters for political reasons.

Bolton describes several episodes where the president expressed willingness to halt criminal investigations “to, in effect, give personal favors to dictators he liked,” citing cases involving major firms in China and Turkey. “The pattern looked like obstruction of justice as a way of life, which we couldn’t accept,” Bolton writes, adding that he reported his concerns to Attorney General William Barr.

Bolton also adds a striking new allegation by saying that Trump overtly linked trade negotiations to his own political fortunes by asking President Xi Jinping of China to buy a lot of American agricultural products to help him win farm states in this year’s election. Trump, he writes, was “pleading with Xi to ensure he’d win. He stressed the importance of farmers, and increased Chinese purchases of soybeans and wheat in the electoral outcome.”

The book, “The Room Where It Happened,” was obtained by The New York Times in advance of its scheduled publication next Tuesday and has already become a political lightning rod in the thick of an election campaign and a No. 1 bestseller on Amazon.com even before it hits the bookstores. The Justice Department filed a last-minute lawsuit against Bolton this week seeking to stop publication even as Trump’s critics complained that Bolton should have come forward during impeachment proceedings rather than save his account for a $2 million book contract.

While other books by journalists, lower-level former aides and even an anonymous senior official have revealed much about the Trump White House, Bolton’s volume is the first tell-all memoir by such a high-ranking official who participated in major foreign policy events and has a lifetime of conservative credentials. It is a withering portrait of a president ignorant of even basic facts about the world, susceptible to transparent flattery by authoritarian leaders manipulating him and prone to false statements, foul-mouthed eruptions and snap decisions that aides try to manage or reverse.

Trump did not seem to know, for example, that Britain is a nuclear power and asked if Finland is part of Russia, Bolton writes. He came closer to withdrawing the United States from NATO than previously known. Even top advisers who position themselves as unswervingly loyal mock him behind his back. During Trump’s 2018 meeting with North Korea’s leader, according to the book, Secretary of State Mike Pompeo slipped Bolton a note disparaging the president, saying, “He is so full of shit.”

A month later, Bolton writes, Pompeo dismissed the president’s North Korea diplomacy, declaring that there was “zero probability of success.”

Intelligence briefings with the president were a waste of time “since much of the time was spent listening to Trump, rather than Trump listening to the briefers.” Trump likes pitting staff members against one another, at one point telling Bolton that former Secretary of State Rex Tillerson had once referred to Nikki Haley, then the ambassador to the United Nations, by a sexist obscenity — an assertion Bolton seemed to doubt but found telling that the president would make it.

Trump said so many things that were wrong or false that Bolton in the book regularly includes phrases like “(the opposite of the truth)” following some quote from the president. And Trump in this telling has no overarching philosophy of governance or foreign policy but rather a series of gut-driven instincts that sometimes mirrored Bolton’s but other times were, in his view, dangerous and reckless.

“His thinking was like an archipelago of dots (like individual real estate deals), leaving the rest of us to discern — or create — policy,” Bolton writes. “That had its pros and cons.”

Bolton is a complicated, controversial figure. A former official under Presidents Ronald Reagan, George Bush and George W. Bush who rose to United Nations ambassador, he has been one of the most vocal advocates for a hard-line foreign policy, a supporter of the Iraq War who has favored possible military action against rogue states like North Korea and Iran.

Like Tillerson and other officials who went to work for Trump believing they could manage him, Bolton agreed to become the president’s third national security adviser in 2018 thinking he understood the risks and limits. But unlike some of the so-called “axis of adults,” as he calls Tillerson and former Defense Secretary Jim Mattis, who tried to minimize what they saw as the damage of the president’s tenure, Bolton sought to use his 17 months in the White House to accomplish policy goals that were important to him, like withdrawing the United States from a host of international agreements he considers flawed, like the Iran nuclear accord, the Intermediate-Range Nuclear Forces Treaty and others.

Bolton thought Trump’s diplomatic flirtation with the likes of North Korea’s Kim Jong Un and President Vladimir Putin of Russia were ill-advised and even “foolish” and spent much of his tenure trying to stop the president from making what he deemed bad deals. He eventually resigned last September — Trump claimed he fired him — after they clashed over Iran, North Korea, Ukraine and a peace deal with the Taliban in Afghanistan.

Bolton did not agree to testify during the House impeachment inquiry last fall, saying he would wait to see if a judge would rule that former aides like him should do so over White House objections. But after the House impeached Trump for abuse of power for withholding security aid while pressuring Ukraine to publicly announce investigations into Democrats, including former Vice President Joe Biden, Bolton offered to testify in the Senate trial if subpoenaed.

Senate Republicans blocked calling Bolton as a witness even after the Times reported in January that his then-unpublished book confirmed that Trump linked the suspended security aid to his insistence that Ukraine investigate his political rivals. The Senate went on to acquit Trump almost entirely along party lines. But Bolton engendered great anger among critics of the president for not making his account public before now.

The book confirms House testimony that Bolton was wary all along of the president’s actions with regard to Ukraine and provides firsthand evidence of his own that Trump explicitly linked the security aid to investigations involving Biden and Hillary Clinton. On Aug. 20, Bolton writes, Trump “said he wasn’t in favor of sending them anything until all the Russia-investigation materials related to Clinton and Biden had been turned over.” Bolton writes that he, Pompeo and Defense Secretary Mark Esper tried eight to 10 times to get Trump to release the aid.

Bolton, however, had nothing but scorn for the House Democrats who impeached Trump, saying they committed “impeachment malpractice” by limiting their inquiry to the Ukraine matter and moving too quickly for their own political reasons. Instead, he said they should have also looked at how Trump was willing to intervene in investigations into companies like Turkey’s Halkbank to curry favor with President Recep Tayyip Erdogan of Turkey or China’s ZTE to favor Xi.

Trump married politics with policy during a meeting with Xi on the sidelines of the Group of 20 summit meeting in Osaka, Japan, last summer, according to the book. Xi told Trump that unnamed political figures in the United States were trying to spark a new cold war with China.

“Trump immediately assumed Xi meant the Democrats,” Bolton writes. “Trump said approvingly that there was great hostility among the Democrats. He then, stunningly, turned the conversation to the coming U.S. presidential election, alluding to China’s economic capability to affect the ongoing campaigns, pleading with Xi to ensure he’d win.” Bolton says he would have printed Trump’s exact words, “but the government’s prepublication review process has decided otherwise.”

Bolton does not say these are necessarily impeachable offenses and adds that he does not know everything that happened with regard to those episodes, but he reported them to Barr and Pat Cipollone, the White House counsel. They should have been investigated by the House, he said, and at the very least suggested abuses of a president’s duty to put the nation’s interests before his own.

“A president may not misuse the national government’s legitimate powers by defining his own personal interest as synonymous with the national interest, or by inventing pretexts to mask the pursuit of personal interest under the guide of national interest,” Bolton writes. “Had the House not focused solely on the Ukraine aspects of Trump’s confusion of his personal interests,” he adds, then “there might have been a greater chance to persuade others that ‘high crimes and misdemeanors’ had been perpetrated.”