WASHINGTON (AP) — President Donald Trump “pleaded” with China’s Xi Jinping during a 2019 summit to help his reelection prospects, according to a scathing new book by former Trump adviser John Bolton that accuses the president of being driven by political calculations when making national security decisions.

The White House worked furiously to block the book, asking a federal court for an emergency temporary restraining order Wednesday against its release.

Bolton's allegations that Trump solicited Chinese help for his reelection effort carried echoes of Trump’s attempt to get political help from Ukraine, which led to his impeachment.

“I am hard-pressed to identify any significant Trump decision during my tenure that wasn’t driven by re-election calculations,” Bolton wrote.

The 577-page book paints an unvarnished portrait of Trump and his administration, amounting to the most vivid, first-person account yet of how Trump conducts himself in office. Several other former officials have written books, but most have been flattering about the president. Other former officials have indicated they were saving their accounts of their time working for Trump until after he left office to speak more candidly. The Associated Press obtained a copy of Bolton’s book in advance of its release next week.

Bolton, Trump's national security adviser for a 17-month period, called Trump's attempt to shift the June 2019 conversation with Xi to the U.S. election a stunning move and wrote that it was among innumerable conversations that he found concerning. He added that Congress should have expanded the scope of its impeachment inquiry to these other incidents.

Deeply critical of the president and much of his senior team, Bolton wrote that because staff had served him so poorly, Trump “saw conspiracies behind rocks, and remained stunningly uninformed on how to run the White House, let alone the huge federal government.” He added that while he was at the White House, Trump typically had only two intelligence briefings a week “and in most of those, he spoke at greater length than the briefers, often on matters completely unrelated to the subjects at hand.”

Trump was asked about the book Wednesday on Fox News Channel's “Hannity," and the president accused Bolton of violating the law by releasing the book. “He broke the law. Very simple. I mean, as much as it’s going to be broken,” Trump said. “It’s highly classified information, and he did not have approval.”

He tweeted early Thursday that the book “is made up of lies & fake stories" by a “disgruntled boring fool who only wanted to go to war.”

The book includes embarrassing claims that Trump thought Finland was part of Russia, didn't know that the United Kingdom was a nuclear power and called reporters “scumbags” who should be “executed.”

As for the meeting with the Chinese president in Osaka, Japan, Bolton wrote that Trump told Xi that Democrats were hostile to China.

“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 said. “He stressed the importance of farmers, and increased Chinese purchases of soybeans and wheat in the electoral outcome.”

Bolton wrote that he would print Trump’s exact words, “but the government’s pre-publication review process has decided otherwise."

The book, titled “The Room Where It Happened: A White House Memoir,” is set to be released Tuesday by Simon & Schuster. It has been the subject of a lengthy battle between Bolton and the White House.

The Justice Department sued on Tuesday in an effort to delay publication of the book, claiming that it still contained highly classified information and that a required review by the National Security Council had not been concluded. According to the filing, a career official determined no classified material remained in April, but national security adviser Robert O’Brien initiated a secondary review that deemed additional information to be classified.

Bolton wrote that he was asked to add phrases like, “in my view,” to make it clear he was expressing his opinion instead of relying on sensitive information. In others, he was asked to describe things more generally. He was asked to remove quotation marks nearly every time he recounts conversation between Trump and foreign leaders and himself and foreign leaders.

The White House’s contention that so much of the book was classified appeared to be a tacit admission that many of Bolton’s allegations were accurate — as inaccurate information could not be classified.

U.S. Trade Representative Robert Lighthizer said Wednesday that he attended a meeting between Trump and Xi at the Group of 20 nations in Osaka but never heard Trump pleading with Xi to buy more agriculture products to ensure he would win reelection.

“Absolutely untrue. Never happened. I was there. I have no recollection of that ever happening. I don’t believe it’s true. I don’t believe it ever happened,” Lighthizer said at a Senate hearing on trade issues. “Would I recollect something as crazy as that? Of course I would recollect it.”

Bolton wrote that he raised some of his concerns about Trump’s conversations with foreign leaders with Attorney General William Barr and flagged similar worries with White House attorneys and Secretary of State Mike Pompeo.

“The pattern looked like obstruction of justice as a way of life, which we couldn’t accept," he wrote.

Trump continually pandered to Xi, Bolton wrote. At a White House Christmas dinner in 2018, Bolton said Trump asked why the U.S. was sanctioning China over its treatment of Uighurs. China suspects Uighurs, who are predominantly Muslim and culturally and ethnically distinct from the majority Han Chinese population, of harboring separatist tendencies. In recent years, China has dramatically escalated its campaign against them by detaining more than 1 million people in internment camps and prisons.

“At the opening dinner of the Osaka G-20 meeting, with only interpreters present, Xi explained to Trump why he was basically building concentration camps in Xinjiang,” Bolton wrote. “According to our interpreter, Trump said that Xi should go ahead with building the camps, which he thought was exactly the right thing to do. "

In the book, Bolton describes every Trump decision as being guided by concerns for his own reelection, a claim that evokes the scandal that sparked Trump’s impeachment last year.

The book alleges that Trump directly tied providing military aid to Ukraine to the country’s willingness to conduct investigations into his Democratic challenger Joe Biden and Biden's son Hunter. In one conversation, 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.

Trump’s decision to withhold military assistance to Ukraine until it agreed to investigate Biden led the House to charge Trump was abusing his power. The aid was ultimately released once the holdup became public. The GOP-controlled Senate ultimately acquitted the president on that count and a count of obstructing Congress’ investigation of the incident.

Bolton was called to testify before House lawmakers conducting the impeachment inquiry, but he declined, suggesting he wanted a federal court to decide whether he should heed a White House directive not to cooperate with the inquiry.

House Intelligence Chairman Adam Schiff, D-Calif., who managed the impeachment case against Trump, said Thursday “we'll never know” if Bolton's testimony might have made a difference in the case.

Schiff told “CBS This Morning” that Bolton's decision to save his information for his book was "the price the country had to pay for John Bolton’s putting profit above country.”