Editor's note: This article is adapted from "A Very Stable Genius: Donald J. Trump's Testing of America," to be published Tuesday, Jan. 21, by Penguin Press.

There is no more sacred room for military officers than 2E924 of the Pentagon, a windowless and secure vault where the Joint Chiefs of Staff meet regularly to wrestle with classified matters. Its more common name is "the Tank." Inside its walls, flag officers observe a reverence and decorum for the wrenching decisions that have been made there.

Hanging prominently on one of the walls is "The Peacemakers," a painting that depicts an 1865 Civil War strategy session with President Abraham Lincoln and his three service chiefs — Lt. Gen. Ulysses S. Grant, Maj. Gen. William Tecumseh Sherman, and Rear Adm. David Dixon Porter. Some 152 years after Lincoln made plans to preserve the Union, President Donald Trump's advisers staged an intervention inside the Tank to try to preserve the world order.

By that point, six months into his administration, Secretary of Defense Jim Mattis, National Economic Council Director Gary Cohn, and Secretary of State Rex Tillerson had grown alarmed by gaping holes in Trump's knowledge of history, especially the key alliances forged following World War II.

Trump organized his unorthodox worldview under the simplistic banner of "America First," but Mattis, Tillerson and Cohn feared his proposals were rash, barely considered, and a danger to U.S. superpower standing. They also felt that many of Trump's impulsive ideas stemmed from his lack of familiarity with U.S. history. To have a useful discussion with him, the trio agreed, they had to create a basic knowledge, a shared language.

July 20, 2017

Mattis had invited Trump to the Tank for what he, Tillerson, and Cohn had carefully organized as a tailored tutorial. What happened inside the Tank that day crystallized the commander-in-chief's ­berating, derisive and dismissive manner, foreshadowing decisions such as the one earlier this month that brought the U.S. to the brink of war with Iran. The Tank meeting was a turning point in Trump's presidency. Rather than getting him to appreciate America's traditional role and alliances, Trump began to tune out and eventually push away the experts who believed their duty was to protect the country by restraining his more dangerous impulses.

The episode has been documented numerous times, but subsequent reporting reveals a more complete picture of the moment and the chilling effect Trump's comments and hostility had on the nation's military and national security leadership.

On a scorching summer Thursday, Trump arrived at the Pentagon. He walked along a corridor with portraits honoring former chairmen of the Joint Chiefs, and stepped inside the Tank. The uniformed officers greeted their commander in chief. Chairman of the Joint Chiefs Gen. Joseph Dunford sat in the seat of honor midway down the table, because this was his room, and Trump sat at the head of the table facing a projection screen. Mattis and Deputy Defense Secretary Patrick Shanahan sat to the president's left, with Vice President Mike Pence and Tillerson to his right. Down the table sat the leaders of the military branches, along with Cohn and Treasury Secretary Steven Mnuchin. White House chief strategist Steve Bannon was in the outer ring of chairs with other staff, taking his seat directly in Trump's line of sight.

Mattis, Cohn and Tillerson and their aides decided to use maps, graphics, and charts to tutor Trump. Mattis opened with a slide show punctuated by lots of dollar signs. He devised a strategy to use terms the impatient president, schooled in real estate, would appreciate to impress upon him the value of U.S. investments abroad. He sought to explain why U.S. troops were deployed in so many regions and why America's safety hinged on a complex web of trade deals, alliances, and bases across the globe.

An opening line flashed on the screen, setting the tone: "The post-war international rules-based order is the greatest gift of the greatest generation." Mattis then gave a 20-minute briefing on the NATO alliance. Bannon thought to himself, "Not good. Trump is not going to like that one bit." The internationalist language Mattis was using was a trigger for Trump.

"Oh, baby, this is going to be f — -ing wild," Bannon thought. "If you stood up and threatened to shoot Trump, he couldn't say 'postwar rules-based international order.' It's just not the way he thinks."

For the next 90 minutes, Mattis, Tillerson, and Cohn took turns trying to emphasize their points, pointing to their charts and diagrams. They showed where U.S. personnel were positioned, at military bases, CIA stations, and embassies, and how U.S. deployments fended off the threats of terror cells, nuclear blasts, and destabilizing enemies in places including Afghanistan, Iran, Iraq, the Korea Peninsula, and Syria. Cohn spoke for about 20 minutes about the value of free trade with U.S. allies.

Trump appeared peeved by the schoolhouse vibe but also allergic to the dynamic of his advisers talking at him. His ricocheting attention span led him to repeatedly interrupt. He heard an adviser say a word or phrase and then seized on that to interject with his take. For instance, the word "base" prompted him to launch in to say how "crazy" and "stupid" it was to pay for bases in some nations.

Trump's first complaint: South Korea should pay for a $10 billion missile defense system that the U.S. built for it. The system was designed to shoot down any short- and medium-range ballistic missiles from North Korea to protect South Korea and U.S. troops stationed there. "We should charge them rent," Trump said of South Korea. "We should make them pay for our soldiers. We should make money off of everything."

Trump proceeded to explain that NATO, too, was worthless. U.S. generals were letting the allied member countries get away with murder, he said, and they owed the U.S. a lot of money after not living up to their promise of paying their dues.

"They're in arrears," Trump said, reverting to the language of real estate. He scolded top officials for the untold millions of dollars he believed they had let slip through their fingers by allowing allies to avoid their obligations.

"We are owed money you haven't been collecting!" Trump told them. "You would totally go bankrupt if you had to run your own business."

Mattis wasn't trying to persuade the president of anything, only to explain and provide facts. Now things were devolving quickly. The general tried to calmly explain to the president that he was not quite right. The NATO allies didn't owe the United States back rent, he said. The truth was more complicated. NATO had a nonbinding goal that members should pay at least 2% of their gross domestic product on their defenses. Only five of the countries currently met that goal, but it wasn't as if they were shorting the U.S.

More broadly, Mattis argued, the NATO alliance was not serving only to protect western Europe. It protected America, too. "This is what keeps us safe," Mattis said. Cohn tried to explain to Trump that he needed to see the value of the trade deals. "These are commitments that help keep us safe," Cohn said.

Bannon interjected. "Stop, stop, stop," he said. "All you guys talk about all these great things, they're all our partners, I want you to name me now one country and one company that's going to have his back."

Trump then repeated a threat he'd made countless times. He wanted out of the Iran nuclear deal that President Barack Obama had struck in 2015. "It's the worst deal in history!" Trump declared.

"Well, actually …" Tillerson interjected. "I don't want to hear it," Trump said, cutting off the secretary of state before he could explain some of the benefits. "They're cheating. They're building. We're getting out of it. I keep telling you, I keep giving you time, and you keep delaying me. I want out of it."

Before they could debate the Iran deal, Trump erupted to revive another frequent complaint: the war in Afghanistan. He demanded an explanation for why the U.S. hadn't won in Afghanistan yet, now 16 years after the nation began fighting there in the wake of the 9/11 terrorist attacks. Trump unleashed his disdain, calling Afghanistan a "loser war." That phrase hung in the air and disgusted not only the military leaders but also the men and women in uniform sitting along the back wall. They all were sworn to obey their commander in chief's commands, and here he was calling the war they had been fighting a loser war.

"You're all losers," Trump said. "You don't know how to win anymore."

Trump questioned why the U.S. couldn't get some oil as payment for the troops stationed in the Persian Gulf. "We spent $7 trillion; they're ripping us off," Trump boomed. "Where is the f — -ing oil?"

Trump seemed to be speaking up for the voters who elected him, and several attendees thought they heard Bannon in Trump's words. Bannon had been trying to persuade Trump to withdraw forces by telling him, "The American people are saying we can't spend a trillion dollars a year on this. We just can't. It's going to bankrupt us."

Trump mused about removing Gen. John Nicholson, the U.S. commander in charge of troops in Afghanistan. "I don't think he knows how to win."

Dunford sought to explain that Nicholson hadn't been charged with annihilating the enemy in Afghanistan but was instead following a strategy started by the Obama administration to gradually reduce the military presence in the country so that eventually the U.S. could pull out. Trump shot back in more plain language.

"I want to win," he said. "We don't win any wars anymore … We spend $7 trillion, everybody else got the oil and we're not winning anymore."

Trump by now was in one of his rages. He was so angry that he wasn't taking many breaths. All morning, he had been coarse and cavalier, but the next several things he bellowed went beyond that description. They stunned nearly everyone in the room, and some vowed that they would never repeat them. Indeed, they have not been reported until now. "I wouldn't go to war with you people," Trump told the assembled brass.

He barked, "You're a bunch of dopes and babies."

For a president known for verbiage he euphemistically called "locker room talk," this was the gravest insult he could have delivered to these people. Some staff began looking down at their papers, rearranging folders. They tried not to reveal their revulsion.

This was a president who had been labeled a "draft dodger" for avoiding service in the Vietnam War under questionable circumstances.

Tillerson in particular was stunned by Trump's diatribe and began visibly seething. For too many minutes, he had been staring straight, dumbfounded, at Mattis, who was speechless, his head bowed down toward the table. Tillerson thought to himself, "Gosh darn it, Jim, say something."

But, as he would later tell close aides, Tillerson realized in that moment that Mattis was genetically a Marine, unable to talk back to his commander in chief, no matter what nonsense came out of his mouth.