The Trump administration has filed a lawsuit seeking to prevent publication of former national security adviser John Bolton's book, which is expected to provide a damning insider portrait of the White House.

The Department of Justice alleged in its suit, filed in federal court in Washington, that publication of the book risks "compromising national security" through revelation of classified information that Mr Bolton had access to during his turbulent 17-month stint in the White House.

The suit says Mr Bolton failed to have the text vetted, meaning his book would be in "clear breach of agreements he signed as a condition of his employment and as a condition of gaining access to highly classified information".

The book, 'The Room Where It Happened: A White House Memoir', is due to hit the shelves next Tuesday.

Mr Bolton, a veteran Washington insider and a controversial figure for his longtime hawkish views, was a close adviser to President Donald Trump.

He is believed to have taken meticulous notes during his various meetings with Mr Trump and other senior personnel.

Mr Bolton left in September after disagreeing with Mr Trump's diplomatic outreach to adversaries, notably North Korea and Afghanistan's Taliban.

Since then, the two have become openly hostile and Mr Bolton's book has been touted as a tell-all from the Oval Office.

"This is the book Donald Trump doesn't want you to read", teased publishers Simon and Schuster.

In particular, Mr Bolton alleges that Mr Trump committed a host of impeachable offences beyond pressuring Ukraine to investigate his political rival, Democrat Joe Biden.

The government says Mr Bolton is in breach of basic secrecy rules after refusing to wait for the National Security Council to go through the text, as required.

The NSC found "significant quantities of classified information that it asked defendant to remove," the court docket said, but the "defendant apparently became dissatisfied at the pace of NSC's review".

It said Mr Bolton and publishers reportedly resolved to release the book on 23 June "without defendant giving any prior notice to the NSC" or completing the pre-publication review process.

"Simply put, defendant struck a bargain with the United States as a condition of his employment in one of the most sensitive and important national security positions in the United States government and now wants to renege on that bargain."

Mr Bolton yesterday retweeted statements by rights groups including by the American Civil Liberties Union, which pointed to a similar effort 50 years ago by the Nixon administration to suppress The Pentagon Papers that was rejected by the Supreme Court.

"Any Trump administration efforts to stop John Bolton's book from being published are doomed to fail," the ACLU stated.