Washington (CNN) President Donald Trump on Wednesday ordered top Navy officials to rescind medals awarded to the prosecutors who unsuccessfully tried Navy SEAL team leader Eddie Gallagher for murder.

Trump, who has previously sided with Gallagher , slammed the prosecutors for "giving immunity in a totally incompetent fashion" in the course of the case and for having "difficulty with respect to information that may have been obtained from opposing lawyers." The President said the Navy lawyers had been "ridiculously given a Navy Achievement Medal."

"I have directed the Secretary of the Navy Richard Spencer & Chief of Naval Operations John Richardson to immediately withdraw and rescind the awards," Trump tweeted.

The Secretary of the Navy is pulling the medals awarded to the Navy prosecution team, a Navy official told CNN. The official said it is within Spencer's authority to rescind the awards.

The President's criticisms appeared to stem from prosecutors' decision to give immunity to a key witness in the case who testified that he -- not Gallagher -- had killed the ISIS captive, as well as the former lead prosecutor's improper use of email software in emails to defense lawyers. That prosecutor was removed from the case.

Read More