President Trump's social media director violated a law that bars federal officials from campaigning when he encouraged a Republican to run against Rep. Justin Amash, R-Mich., the Office of Special Counsel has concluded.

Dan Scavino, a close aide to Trump, tweeted in April that Amash should face "defeat" in his next primary because he had become a "big liability." At the time, Amash was among a handful of House Freedom Caucus members who stood in the way of passing a healthcare reform bill.

https://twitter.com/DanScavino/status/848211792916557824

Critics quickly seized on the tweet as a violation of the Hatch Act, a law that prevents many federal officials from engaging in certain political activity.

In a letter made public Friday, the Office of Special Counsel said Scavino had received a "warning letter" describing his breach of the law and had since undergone counseling from the Office of the White House Counsel.

"Mr. Scavino has been advised that if in the future he engages in prohibited political activity while employed in a position covered by the Hatch Act, we will consider such activity to be a willful and knowing violation of the law," the office noted.

Citizens for Responsibility and Ethics in Washington, a left-leaning watchdog group, had filed a formal complaint about Scavino's conduct with the Office of Special Counsel.