The story below contains explicit language.

Just eight days after the 2020 election, then-President Donald Trump was so determined to end the war in Afghanistan during his presidency that he secretly signed a memo to withdraw all troops by January 15, 2021, according to a new book, “Peril,” from journalists Bob Woodward and Robert Costa.

The November 11 memo, according to the authors, had been secretly drafted by two Trump loyalists and never went through the normal process for a military directive — the secretary of defense, national security adviser and the chairman of the Joint Chiefs had all never seen it. Unpredictable, impulsive, Trump had done an end run around his whole national security team.

In a remarkable scene, the authors write, Chairman of the Joint Chiefs Gen. Mark Milley, newly appointed acting Defense Secretary Chris Miller and his new chief of staff Kash Patel were all blindsided when the memo arrived at the Pentagon.

Woodward and Costa reproduced the memo in “Peril.” The directive was titled, “Memorandum for the Acting Secretary of Defense: Withdrawal from Somalia and Afghanistan,” and the memo read: “I hereby direct you to withdraw all US forces from the Federal Republic of Somalia no later than 31 December 2020 and from the Islamic Republican of Afghanistan no later than 15 January 2021. Inform all allied and partner forces of the directives. Please confirm receipt of this order.”

Milley studied the memo and announced he was heading to the White House to confront Trump.

“This is really fucked up and I’m going to see the President. I’m heading over. You guys can come or not,” Milley told Miller and Patel, who joined him on the trip across the Potomac, according to the book.

At the White House, the three men paid a surprise visit to national security adviser Robert O’Brien and showed him the signed memo.

“How did this happen?” Milley asked O’Brien, according to the book. “Was there any process here at all? How does a president do this?”

O’Brien looked at the memo and said, “I have no idea,” according to the authors.

“What do you mean you have no idea? You’re the national security adviser to the President?” Milley responded. “And the secretary of defense didn’t know about this? And the chief of staff to the secretary of defense didn’t know about this? The chairman didn’t know. How the hell does this happen?”

O’Brien took the memo and left. While the officials had briefly debated whether the memo could be a forgery, Trump confirmed to O’Brien that he had signed it.

“Mr. President, you’ve got to have a meeting with the principals,” O’Brien told Trump, according to the book, which Trump agreed to do and the directive was withdrawn.

It was “effectively a rogue memo and had no standing,” Woodward and Costa write. “All right,” O’Brien said when he returned to his office. “We’ve already taken care of this. It was a mistake. The memo was nullified.”

But the signed rogue memo undercuts the argument that Trump and some of his allies, including Miller, have recently made that Trump never really planned to get out or would have planned the withdrawal better than President Joe Biden.

“If I were now President, the world would find that our withdrawal from Afghanistan would be a conditions-based withdrawal,” Trump said in a statement last month as the Taliban closed in on Kabul. “I personally had discussions with top Taliban leaders whereby they understood what they are doing now would not have been acceptable.”

Axios’ Jonathan Swan and Zachary Basu reported in May that the memo had been drafted by two Trump loyalists who should not have been involved in the process — Johnny McEntee, the former body man who Trump had named head of White House personnel, and controversial retired Lt. Col. Douglas Macgregor, who had just been appointed as an adviser to Miller.

Woodward and Costa write in “Peril” that the memo was also one of the reasons Milley was concerned Trump could go rogue after the November election, and prompted Milley after the January 6 insurrection to take steps to try to limit Trump from launching military strikes or nuclear weapons unless he was consulted.

Eventually, Milley, Miller and Patel left the White House. They never saw the President that day, but after the January 6 assault on the Capitol, Woodward and Costa write that Milley “felt no absolute certainty that the military could control or trust Trump.” Milley “believed it was his job as the senior military officer to think the unthinkable, take any and all necessary precautions.”

Chairman of the Joint Chiefs of Staff Gen. Mark Milley (L) chats with US President Donald Trump after he delivered the State of the Union address at the US Capitol in Washington, DC, on February 4, 2020. (Photo by OLIVIER DOULIERY/AFP via Getty Images)