The New York Times on Wednesday published an explosive opinion piece written by an anonymous senior White House official who described a "two-track presidency" in which top officials are "working diligently from within to frustrate parts of [President Trump's] agenda and his worst inclinations."

The piece quickly triggered anger from inside the White House, as President Trump called it "gutless," and Press Secretary Sarah Sanders demanded the unnamed author "resign."

In the piece, entitled "I Am Part of the Resistance Inside the Trump Administration," the author wrote that the alleged actions by White House officials were not part of "the popular 'resistance' of the left."

The Times' Twitter account indicated that the author was a man. However, a Times spokesperson told Fox News that the tweet in question "was drafted by someone who is not aware of the author's identity, including the gender, so the use of 'he' was an error."

Trump responded at a White House meeting with sheriffs from across America.

"If I weren't here, I believe the New York Times probably wouldn't exist," the president said to laughter and applause from the assembled sheriffs. "And someday when I'm not president, which hopefully will be in about six-and-a-half years from now, The New York Times and CNN and all of these phony media outlets will be out of business ... because there'll be nothing to write."

Trump tweeted late Wednesday night, promising to drain the swamp, vowing, "We will win."

In a statement, Sanders said the author of the piece was "a gutless, anonymous source to the failing New York Times."

"We are disappointed, but not surprised, that the paper chose to publish this pathetic, reckless, and selfish op-ed. This is a new low for the so-called 'paper of record,' and it should issue an apology," said Sanders, adding: "The individual behind this piece has chosen to deceive, rather than support, the duly elected President of the United States. He is not putting country first, but putting himself and his ego ahead of the will of the American people. This coward should do the right thing and resign."

Trump tweeted earlier: "Does the so-called 'Senior Administration Official' really exist, or is it just the Failing New York Times with another phony source? If the GUTLESS anonymous person does indeed exist, the Times must, for National Security purposes, turn him/her over to government at once!"

"We are incredibly proud to have published this piece, which adds significant value to the public's understanding of what is going on in the Trump administration from someone who is in a position to know," a Times spokesperson said in response to the White House statements.

The op-ed's author wrote that the officials "want the administration to succeed and think that many of its policies have already made America safer and more prosperous ... But these successes have come despite — not because of — the president’s leadership style, which is impetuous, adversarial, petty and ineffective."

TRUMP BATTLES BOB WOODWARD BOOK, BUT AGREES ON ONE POINT: 'I'M TOUGH AS HELL ON PEOPLE'

The op-ed was published one day after The Washington Post published excerpts from a forthcoming book by longtime reporter Bob Woodward in which the Trump administration was depicted as filled with second-guessing staffers and Cabinet members filching papers from the president's desk before he could sign them.

Earlier Wednesday, Trump decried Woodward's book as "total fiction" and "untrue."

"From the White House to executive branch departments and agencies, senior officials will privately admit their daily disbelief at the commander in chief’s comments and actions," the official wrote.

"Meetings with him veer off topic and off the rails, he engages in repetitive rants, and his impulsiveness results in half-baked, ill-informed and occasionally reckless decisions that have to be walked back."

The author specifically noted Trump's reluctance to take action against the Russian government after a former Russian spy-turned-double agent and his daughter were poisoned with a nerve agent earlier this year in the U.K.

"He complained for weeks about senior staff members letting him get boxed into further confrontation with Russia, and he expressed frustration that the United States continued to impose sanctions on the country for its malign behavior," the official writes. "But his national security team knew better — such actions had to be taken, to hold Moscow accountable."

The official said the like-minded colleagues were not carrying out the work of favorite Trump bogey "the so-called deep state," but rather were working for "the steady state." The writer also alleged that "there were early whispers within the cabinet of invoking the 25th Amendment" to remove Trump from office because of the president's "instability ... But no one wanted to precipitate a constitutional crisis. "

"So we will do what we can to steer the administration in the right direction," the author wrote, "until — one way or another — it's over."