WASHINGTON (AP) — A federal judge agreed Thursday to temporarily block the Pentagon from punishing Democratic Senator Mark Kelly, a former Navy pilot, for participating in a video that called on troops to resist unlawful orders.

U.S. District Judge Richard Leon ruled that Pentagon officials violated Kelly’s First Amendment rights and 'threatened the constitutional liberties of millions of military retirees.'

Kelly, who represents Arizona, sued in federal court to block his Jan. 5 censure from Defense Secretary Pete Hegseth.

In November, Kelly and five other Democratic lawmakers appeared in a video urging troops to uphold the Constitution and not to follow unlawful military directives during the Trump administration.

Republican President Donald Trump accused the lawmakers of sedition 'punishable by DEATH' in a social media post soon after.

Hegseth claimed Kelly’s censure was a necessary step towards proceedings that could lead to a demotion from his retired rank of captain and a subsequent reduction in retirement pay.

The judge concluded that Kelly’s speech was entitled to full First Amendment protection, dismissing the government's claims that he was trying to evade military justice rules.

Leon stated, 'Rather than trying to shrink the First Amendment liberties of retired servicemembers, Secretary Hegseth and his fellow defendants might reflect and be grateful for the wisdom and expertise that retired servicemembers have brought to public discussions and debate on military matters in our nation over the past 250 years.'

Kelly commented on the ruling, emphasizing that it represents a fight against governmental overreach, expressing concerns that the administration could impose similar consequences on other veterans speaking out on military matters.

The Pentagon began investigating Kelly in late November, citing a federal law that allows the recall of retired service members for possible military justice procedures. Hegseth insisted that Kelly was the only individual under inquiry due to his formal retirement status.

Kelly's legal team has asserted that the Pentagon’s actions against him constitute an unprecedented attack on veterans' rights to engage in national security discussions. The lawsuit names Hegseth, the Department of Defense, and other high-ranking military officials as defendants.