The Treasury Department on Wednesday retweeted a post from President Trump celebrating Republican wins in congressional elections this year, potentially violating federal campaign law.

The department's official Twitter account shared a tweet from Trump touting results from elections held Tuesday night and an upcoming "Red Wave" of GOP congressional victors.

"Great Republican election results last night. So far we have the team we want. 8 for 9 in Special Elections. Red Wave!" Trump tweeted at 8:30 a.m.

Treasury deleted the retweet soon after media outlets raised questions about its legality.

A department spokesperson told The Hill that the retweet "was done in error and has been taken down."

Treasury's retweet of a campaign-related post appears to risk violating the Hatch Act, a law that bans federal employees from engaging in political activity while on duty or serving in any official capacity.

Several Trump administration officials have been found to have violated the Hatch Act by the Office of Special Counsel (OSC), which enforces ethics rules for federal employees. The agency is not related to special counsel Robert Mueller or his Russia investigation.

The OSC said in March that top White House counselor Kellyanne Conway violated the Hatch Act twice in TV appearances when she "impermissibly mixed official government business with political views about candidates."

The agency also warned Federal Communications Commission (FCC) Commissioner Mike O'Rielly in May that he violated the Hatch Act when he called on voters to support Trump and GOP candidates at a conservative political convention.

U.S. Ambassador to the United Nations Nikki Haley was also found to have violated the act by retweeting an endorsement from Trump in October. And Dan Scavino, the White House social media director, was also found to have violated the act last year after encouraging potential GOP challengers to oust Rep. Justin Amash (R-Mich.).Government watchdog nonprofits have also filed several other Hatch Act complaints against top Trump administration officials for tweets supporting the president's 2020 re-election campaign.

Citizens for Responsibility and Ethics in Washington filed complaints against 10 administration officials earlier this month, including White House press secretary Sarah Huckabee Sanders and Office of Management and Budget Director Mick Mulvaney.