By ANNE FLAHERTY, ABC News

(WASHINGTON) — For four years, Republican staffers and agency chiefs worked for President Donald Trump to keep the federal government humming and, in many cases, dismantle Obama-era policies they believed ran counter to free-market principles.

In the end, the political aides departed Washington this week with their legacies forever linked to a president who refused to concede a democratic election and instead inspired a mob of rioters to confront Congress.

It was, as several Cabinet secretaries and political aides said in their final hours, regrettable.

“It is regretful that our service comes to an end under this cloud of disgrace caused by our President,” wrote Corry Schiermeyer, a Republican official who worked for the Bush administration and returned to Washington to work under Trump at the Department of Homeland Security and the Environmental Protection Agency.

“I believe we were able to implement several policies and regulatory reforms that are greatly benefitting the American people, protecting human health and the environment while allowing for economic prosperity across the country. We have much to be proud as we exit EPA,” wrote Schiermeyer.

A similar sentiment had already been embraced elsewhere by Trump’s Cabinet secretaries.

“Unfortunately,” wrote Health and Human Services Secretary Alex Azar in a lengthy resignation letter outlining his agency’s accomplishments under his watch, “the actions and rhetoric following the election … threaten to tarnish these and other historic legacies of this Administration.”

Transportation Secretary Elaine Chao and Education Secretary Besty DeVos echoed that frustration in their abrupt departures earlier in the month in the wake of the Capitol riot, specifically citing the role the president’s rhetoric played in spurring on the violence.

“We should be highlighting and celebrating your administration’s many accomplishments on behalf of the American people. Instead, we are left to clean up the mess caused by violent protestors overrunning the U.S. Capitol in an attempt to undermine the people’s business,” DeVos wrote.

The frustration of being forever tied to such a controversial president isn’t universal.

Many political aides in Washington see their jobs as carrying out basic government functions needed to keep the country running regardless of who is president.

Such tasks include national security, distributing emergency aid such as food and housing vouchers, collecting nationwide economic data relied on by investors, and maintaining and overseeing U.S. national parks. These jobs are often run by career staff independent of Trump, but they answer to political appointees who take their orders from the White House.

Without those political appointees, the federal agencies would have kept running but without any firm direction and even bipartisan efforts can languish.

“It shouldn’t matter who the president is when you’re serving the public. Someone has to do the job,” said one senior political official at an agency, who spoke on condition of anonymity because the person was not authorized to speak publicly.

To others, Trump handed them a rare golden opportunity to change a system they consider broken — to their liking. And some aides even expressed optimism that the president’s own legacy will be viewed — in time — with a broader lens than the Jan. 6 riots.

Seema Verma, an opponent of Obama-era health care law who came to Washington to run the Centers for Medicare and Medicaid Services under Trump, condemned the recent violence in a staff address in which she made clear her trust lied with Vice President Mike Pence.

When asked in an interview about Trump though, Verma declined to criticize him.

“The president put me in this role, and he’s empowered me to create and to implement this agenda,” she told ABC News. “And for that I’m very appreciative because it allowed me to get this work accomplished, and he wasn’t afraid to take on special interest groups.”

For other political aides, the events of the past month have been disillusioning. One former administration official, who left prior to the riots, was so angry about Trump’s role in urging on the rioters that the person removed photos of any presidential events from their office.

Photos of Pence, however, remained.

“I’m ashamed of the man,” the former administration official said of Trump. “Not the work we did.”

ABC News’ Luke Barr contributed to this report.

Copyright © 2021, ABC Audio. All rights reserved.