WASHINGTON — A close adviser to ex-Defense Secretary James Mattis has written a "sometimes shocking" book detailing the "complicated relationship" between Mattis and President Donald Trump, and describing how Mattis worked to block some of Trump's proposals, according to a press release obtained by NBC News ahead of the book's official distribution.

Written by the secretary's former communications director, retired Navy Cmdr. Guy "Bus" Snodgrass, "Holding the Line: Inside the Pentagon With General Mattis" is scheduled for publication by Sentinel in October.

The press release describes the book as "an insider's sometimes shocking account of how Defense Secretary James Mattis led the U.S. military through global challenges while serving as a crucial check on the Trump Administration."

"Holding the Line" is the first book by one of Mattis' closest advisers, and is the first look behind the scenes of Mattis' nearly two-year tenure as defense secretary. Mattis, a former Marine Corps general, rarely engaged with the media and kept a lower profile than previous defense secretaries. He resigned in December after Trump announced an immediate U.S. withdrawal from Syria.

Snodgrass spent 17 months inside the secretary's inner circle, and wrote the book based off his "meticulous notes," according to the release.

As chief speechwriter and communications director, Snodgrass was responsible for writing some of Mattis' most visible and critical speeches and reports. A former F/A-18 pilot and TOPGUN instructor, Snodgrass left his position with Mattis and retired from the military in 2018.

The press release says Snodgrass provides a "fly-on-the-wall view of Mattis" during critical national security events and crises, including "learning about major policy decision via Twitter, rather than from the White House" and how Mattis "slow-rolled some of Trump's most controversial measures, with no intention of following through."

Contacted by NBC News, Snodgrass said he is finishing the book and plans to submit it to the Pentagon for review before publication, as is required to ensure no classified material is inadvertently included.

Mattis could not immediately be reached for comment.