A federal judge on Monday granted a stay of execution for Nidal Hasan, the former Army psychiatrist convicted in the 2009 Fort Hood shooting, three days before he was scheduled to face a military firing squad.

Judge Anthony Mattivi issued the stay after a hearing in Kansas City, Kansas, where Hasan appeared in person — his first appearance in a civilian courthouse in years — surrounded by military police and wearing a bulletproof vest. The judge gave Hasan until June 1 to file a habeas corpus petition arguing that his constitutional rights were violated during his 2013 court-martial.

Hasan, now 56, was convicted of murdering 13 people and attempting to murder 32 more in the November 2009 attack at Fort Hood, Texas. He has always admitted to the shootings, telling the military judge at his trial that he carried out the attack in defense of Taliban members.

At Monday's hearing, Hasan told the judge he would no longer represent himself and would instead use lawyers provided by the American Civil Liberties Union, which opposes capital punishment. The ACLU said every person facing an irreversible punishment “must have a chance to pursue federal review of his case.”

The Trump administration opposed the stay, arguing in a filing on Friday that Hasan's claims were “untimely and meritless.” President Donald Trump signed off on Hasan's death sentence last month, and the execution had been scheduled for Thursday, December 3, at 1 p.m. Central Time at Fort Hood.

Hasan would have been the first person to face a military execution in 65 years, and the firing squad method was last used by the U.S. military during World War II. Defense Secretary Pete Hegseth initially said the execution would be livestreamed to the public; Mr. Trump later reversed that decision, reportedly after learning Hasan is paralyzed from the waist down.