WASHINGTON – A senior administration official penned an anonymous essay in The New York Times on Wednesday describing President Donald Trump as erratic and amoral and said his aides were actively working to thwart him on decisions that are detrimental to the nation.

"It may be cold comfort in this chaotic era, but Americans should know that there are adults in the room. We fully recognize what is happening. And we are trying to do what’s right even when Donald Trump won’t," the unnamed official wrote.

Shortly after 6 p.m. ET, Trump tweeted a single word in response to the piece: "TREASON?"

More:Treason has a narrow legal definition, but has been a common political insult

Then later, he demanded the Times name whoever wrote the op-ed.

In a third tweet, at 11:22 p.m. EST, Trump wrote, "I'm draining the Swamp, and the Swamp is trying to fight back. Don't worry, we will win!"

Like most major U.S. publications, The New York Times does not typically publish anonymous opinion articles. It called Wednesday’s decision to publish the op-ed about the president “rare." The newspaper said it was not disclosing the identity of the author because doing so would jeopardize that person's job.

More than an hour after the essay, entitled "I am Part of the Resistance Inside the Trump Administration," was posted, Trump spoke about it in the East Room of the White House, where he attacked the New York Times and the unnamed official.

"Can you believe it? Anonymous – meaning gutless," Trump told reporters during an event with sheriffs from across the U.S.

He added people don't like him because his agenda doesn't always match what others want.

“Nobody has ever done more in less than a two-year period than what we’ve done,” Trump said.

Pinal County Sheriff Mark Lamb of Arizona was among the sheriffs attending the White House meeting. Lamb said he thought Trump handled a reporter's question about the Times story well.

“What he did is he turned it around and focused on the positive things that the administration has done. He started quoting things from another article, just about the different accomplishments they’ve had,” Lamb said.

“He kind of quickly, I guess you could say, he somewhat rebuked him (the reporter). I think it was more of a ‘Hey let’s not focus on that anonymous person saying that, let’s focus on the positive, this article here says we’ve done this, and this, and this good.’”

White House press secretary Sarah Sanders slammed the essay as "pathetic, reckless, and selfish" and said the official who wrote it should resign.

"This is a new low for the so-called 'paper of record,' and it should issue an apology," she said.

The piece chronicled the work of the anonymous writer, along with other "senior officials" in the administration, who dub themselves part of a "quiet resistance" to the president to "frustrate parts of his agenda and his worst inclinations."

The Times detailed several examples to USA TODAY where they allowed unnamed people to write essays, but all of the examples revolved around immigration and those who have lived under the rule of terrorists, nothing close to members of the president's administration.

Along with it being unusual for a newspaper to decide to print an anonymous essay by a member of the president's team, it is also rare to have someone that high up in government to open up and bash the commander in chief in such a public way.

More:Eight things to know about the 25th Amendment

"But we believe our first duty is to this country, and the president continues to act in a manner that is detrimental to the health of our republic," the piece said. "That is why many Trump appointees have vowed to do what we can to preserve our democratic institutions while thwarting Mr. Trump’s more misguided impulses until he is out of office."

The timing of the piece came a day after excerpts were published from a forthcoming book by veteran journalist Bob Woodward that depicted chaos inside the White House and efforts by aides to prevent the president from taking actions they viewed as irresponsible. The book, "Fear: Trump in the White House," included details of Trump's top aides removing documents from the president's desk or hiding paperwork.

The official said there had been whispers within the Cabinet of invoking the 25th Amendment, which would allow the vice president to take over if a commander in chief becomes disabled.

"But no one wanted to precipitate a constitutional crisis," the official wrote. "So we will do what we can to steer the administration in the right direction until – one way or another – it’s over."

The senior official described Trump as "impetuous, adversarial, petty and ineffective."

"The erratic behavior would be more concerning if it weren’t for unsung heroes in and around the White House," the author wrote. "Some of his aides have been cast as villains by the media. But in private, they have gone to great lengths to keep bad decisions contained to the West Wing, though they are clearly not always successful."

Contributing: Gregory Korte, Uriel J. Garcia