WASHINGTON — Across the government, an unprecedented digital insurrection is taking shape.

President Donald Trump spent much of his campaign bashing the federal government, a system he described as awash in “waste fraud and abuse.”

Now, the bureaucracy is biting back.

In response to Trump's hiring freeze for federal agencies and a communications blackout, some official social media accounts have tweeted out messages decidedly at odds with his agenda while leaks are flowing into newsrooms from across the federal government.

Some agencies have been notably subversive in their messages, posting quotes and commentary that could be seen as trying to bait their new boss into a confrontation.

The Defense Department used Twitter on Wednesday to publicize an article about an Iraqi refugee who became a U.S. Marine.

“From refugee to #Marine. @USMC Cpl Ali J. Mohammed takes the fight to the doorstep of those who cast his family out,” the department wrote of his fight in Iraq.

Hours earlier, Trump's aides said the president is working out the details of plans to restrict refugees coming into the country.

Former Cabinet officials say the president would be wise not to underestimate the power of the civil service, which not only has the ability to slow the progress of new regulations but also the inside knowledge to sound alarms when needed.

Roughly 4,000 of more than 2 million federal government jobs can be filled by presidential appointment, meaning that career employees far outnumber the advisers, agency directors, special assistants, ambassadors and Cabinet officials selected by Trump.

“Trump's statements have poisoned the well to a degree,” said Christine Todd Whitman, the head of the Environmental Protection Agency under President George W. Bush. “If the career staff ... don't trust you, then things can get very cumbersome.”

White House press secretary Sean Spicer said Wednesday that certain government agencies are taking action to address an “inappropriate” use of social media.

But despite broad orders not to engage with the public or media without permission, it's going to be tricky for the White House to plug all the possible leaks or to stop public outbursts from angry or concerned government workers.

Even before Trump office, employees at the Energy Department shared information about a request from his transition team for the names of department staffers who'd worked on President Barack Obama's climate-change initiatives. The ensuing backlash prompted transition officials to disavow the questionnaire as a mistake.

On Wednesday, The Associated Press obtained a draft of an executive order showing that Trump is considering a major review of America's methods for interrogating terror suspects and the possible reopening of CIA-run “black site” prisons outside the United States.

Trump, who has no government experience, may not fully understand what, exactly, he's facing.

“A CEO of a private company doesn't answer to shareholders or a board,” said Kathleen Sebelius, a secretary of Health and Human Services in the Obama administration. “If you say jump, somebody jumps. That, thank God, is not the way government operates.”

One of the first bureaucracies to enter a standoff with Trump was the Office of Government Ethics, which helps executive branch employees resolve conflicts of interest before taking their posts.

In a series of nine bravado-inflected tweets, director Walter Shaub called for Trump to sell off his financial holdings, which the president has said he will not do.

This week, Shaub was admonished by members of Congress for his actions.

Most of the resistance is coming from agencies with a focus on environmental protection and scientific research.

Several federal Twitter accounts have begun posting social media messages, some of them simply facts about climate change. Trump has notably expressed skepticism about climate science.