James Mattis has long distinguished himself as a canny survivor in Donald Trump’s shape-shifting inner circle, somehow managing to remain firmly entrenched at the Pentagon as fellow advisers such as Rex Tillerson and H. R. McMaster vanished into the vortex that is Trump’s bad side. Then Bob Woodward wrote a book. Now the defense secretary and retired four-star general has been thrust directly into the political maelstrom he’s so studiously avoided.

Excerpts from the journalist’s forthcoming account of Trump’s White House, first published Tuesday in The Washington Post, portray Mattis as scornful of the president’s intellect and judgment, and, in a boost to an already prominent narrative, as a vital check against the president’s dangerous instincts. Woodward depicts an agitated Mattis explaining to Trump in a meeting that the United States maintains a military presence on the Korean peninsula to “prevent World War III” and later deriding the president as “a fifth or sixth grader.” Woodward also claims that when Trump called up Mattis and suggested the United States “fucking kill” Syrian President Bashar al-Assad for using chemical weapons against civilians in 2017, Mattis played along but then hung up the phone and told an aide, “We’re not going to do any of that,” and instead drew up plans for more limited air strikes that Trump ultimately authorized. (Both Mattis and Trump have denied this account.)

There are other passages in Woodward’s book, a copy of which was obtained by The Atlantic ahead of its release next week, that bolster this representation of Mattis. Woodward writes, for example, that the president “scared the daylights” out of Mattis and Joint Chiefs of Staff Chairman Joseph Dunford in January—around the time Trump was engaged in a nuclear button–measuring contest with Kim Jong Un—by proposing that he declare on Twitter that he would be evacuating all family members of U.S. troops from South Korea, which North Korean leaders would likely have interpreted as a clear sign that war was imminent. The tweet was never sent.

But Woodward’s reporting also reveals how Mattis has improbably stayed in Trump’s good graces. He ducks the media, refusing former Press Secretary Sean Spicer’s repeated requests to appear on Sunday talk shows. He finds himself at odds with the president on many major military and foreign-policy issues—U.S. involvement in the Syrian war, America’s military alliances in Europe and Asia, transgender Americans serving in the military—but seems to take his policy defeats (failing to persuade the president to remain in the Iran nuclear deal, for instance) in stride with his unlikely victories (persuading Trump to commit more troops to the war in Afghanistan). He puts only so much stock in face time. “Mattis tried to limit his visits to the White House and stick to military business as much as possible,” Woodward writes.

Woodward also portrays Mattis as sometimes advocating for his more traditionalist foreign-policy positions in passably Trumpian terms. Yes, by Woodward’s account he pointedly informed Trump that America’s forward military deployment in Korea is intended to avert World War III. But by the same account, Mattis also made a cost-benefit argument designed to appeal to a transactional president far more interested in fending off external threats than in leading the free world: that the alliance with South Korea was, as Woodward put it, “one of the great national security bargains of all time.” Part of Mattis’s case against pulling U.S. forces out of Afghanistan, in Woodward’s account, was that Trump, who often styles himself the anti–Barack Obama, shouldn’t leave behind a safe haven for terrorists the way his predecessor did in Iraq.

This, Woodward writes, is the Mattis way: “avoid the confrontation, demonstrate respect and deference, proceed smartly with business, travel as much as possible, get and stay out of town.”

But Woodward’s book itself has presented the starkest test yet of the Mattis way. The defense secretary may be proceeding with business as usual in South Asia this week, but the town and the confrontation have now come to him. And the open question is whether the survivor can survive the test. Mattis was quick to assert that the “contemptuous words about the President attributed to me in Woodward’s book were never uttered by me or in my presence,” and so far that seems to have done the trick. Trump has taken Mattis’s denial and run with it—repeatedlyairing the defense secretary’s statement on Twitter, characterizing the quotes as fabrications, and praising Mattis to reporters as “a terrific person” doing “a fantastic job as secretary of defense.”

But then again, Tillerson held on as secretary of state, twisting in the wind, for five months after reports emerged that he’d called the president a “moron” (a report repeated in Woodward’s book). The revelations about Mattis in Woodward’s book come at a particularly perilous time for the defense secretary, when Trump has settled into the presidency and appears to have grown more confident in his own foreign-policy-making abilities, as well as more intolerant of advisers who object to his plans or challenge his authority. The defense secretary has faded even further from view in recent months, as Secretary of State Mike Pompeo has taken the lead in nuclear negotiations with North Korea and U.S. Trade Representative Robert Lighthizer has spearheaded the trade war with China. On Wednesday, The Washington Post reported that the White House is exploring who could replace Mattis “whenever he might step down,” including retired General Jack Keane and Senators Tom Cotton and Lindsey Graham, and that these discussions predate the Woodward revelations.

When Mattis recently suggested that the U.S. might no longer suspend joint military exercises with South Korea, against the backdrop of a stalemate in talks with North Korea, Trump swiftly undercut him. The “President believes that his relationship with Kim Jong Un is a very good and warm one, and there is no reason at this time to be spending large amounts of money on joint U.S.-South Korea war games,” Trump wrote on Twitter. “As for the U.S.-China trade disputes, and other differences, they will be resolved in time by President Trump and China’s great President Xi Jinping. Their relationship and bond remain very strong.” The subtext was essentially: Thanks Jim, but I alone can fix North Korea and China.

And if the release of Woodward’s book comes at a perilous time for Mattis, it also comes at a perilous time in international affairs. In the near term, the White House has warned of an imminent Assad offensive, potentially involving another use of chemical weapons, in Syria’s last rebel-held stronghold of Idlib. In the longer term, the Trump administration is struggling to resolve the nuclear crisis with North Korea, potentially establishing the conditions for a new one with Iran, and steeling itself for deepening confrontations with China, Russia, and America’s traditional allies. Those allies in particular have tended to see Mattis as their most reassuring interlocutor in the U.S. government—a kind of second secretary of state who reminds them that there is still something recognizable in America’s foreign policy. As the former NATO official Alexander Vershbow told Reuters this summer, Mattis leaving the Trump administration is “the nightmare scenario for the Europeans.”

Military officials must “insist on being heard,” Mattis observed back in in 2015, before he had any inkling that he would one day have to answer to claims that he had compared the American president to an elementary-school kid and had disregarded the commander in chief’s musings about assassinating a head of state. But they must also avoid “creating adversarial relationships with the political leadership” since “at the highest levels, it all depends on personal relationships.” The general’s task, Mattis noted at the time, was to “walk a mile in their shoes as you try to close the gap between the appreciation the military has for the situation and as it’s seen by the political leadership.” The defense secretary has demonstrated remarkable staying power in the Trump administration. But the fallout from Woodward’s book is yet another indication that Mattis’s mile may be nearing its end.

Natasha Bertrand contributed reporting.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.

Uri Friedman is a staff writer at The Atlantic, where he covers global affairs.