James Mattis, who quit as US defense secretary last year, highlights his sharp differences with Donald Trump over Nato allies and the use of torture in a new and eagerly awaited memoir.

The book, Call Sign Chaos, will be published next week. The Guardian obtained a copy. In it, Mattis avoids direct criticism of his former boss but offers some pointed comments that will probably be seized on by opponents of the president.

The retired US marine corps general recalls being surprised in November 2016 when he was called by the then vice-president-elect, Mike Pence, and asked to meet Trump to discuss the job of defense secretary.

Mattis describes being driven to the Trump National Golf Club in Bedminster, New Jersey, and having an “amiable” meeting.

But, he notes: “I figured that my strong support of Nato and my dismissal of the use of torture on prisoners would have the president-elect looking for another candidate.”

Trump had voiced support for torture during the 2016 campaign, suggesting he might order the military to break the law on interrogation tactics, including using waterboarding.

He said: “Don’t tell me it doesn’t work – torture works.”

Mattis apparently managed to change Trump’s mind. The president told the New York Times: “[Mattis] said: ‘I’ve always found, give me a pack of cigarettes and a couple of beers and I do better with that than I do with torture.’ And I was very impressed by that answer.”

The pair also disagreed over Nato, which Trump described as “obsolete”, the Iran nuclear deal, negotiations with North Korea and the creation of a space force. Mattis’ sudden resignation last December came after Trump moved to withdraw all US troops from Syria.

The book offers insight into the riddle of why some mainstream political and military figures have agreed to serve under a president widely seen as dangerous, dishonest and a threat to national security.

Mattis writes: “In my view, when the president asks you to do something, you don’t play Hamlet on the wall, wringing your hands. To quote a great American athletic company’s slogan: ‘Just do it.’ So long as you are prepared, you say yes.”

But Mattis makes clear that his book – co-written with the author, combat veteran and former assistant secretary of defense Bing West – is about how his career in the marines brought him to to becoming defense secretary, not an exhaustive post-mortem on his 712 days in the role.

Mattis offers a brisk but telling explanation of his departure: “When my concrete solutions and strategic advice, especially keeping faith with allies, no longer resonated, it was time to resign, despite the limitless joy I felt serving alongside our troops in defense of the constitution.”

Mattis, who in 2017 urged troops stationed abroad to “hold the line” despite partisan division at home, expands on that point in his book.

“Unlike in the past, where we were unified and drew in allies, currently our own commons seems to be breaking apart,” he writes.

“What concerns me most as a military man, coming out of a diverse yet unified culture, is not our external adversaries; instead, it is our internal divisiveness.”

He adds: “We are diving into hostile tribes cheering against each other, fueled by emotion and a mutual disdain that jeopardizes our future, instead of rediscovering our common ground and finding solutions.”

Many commentators blame Trump for stoking division, particularly along racial lines. Mattis, who has returned to the Hoover Institution thinktank at Stanford University in Palo Alto, California, does not identity the president as the source of such rancor.