A federal judge on Monday temporarily halted the execution of former Army Maj. Nidal Hasan, who was scheduled to die by firing squad Thursday for the 2009 attack at Fort Hood that killed 13 people and injured more than 30 others.

U.S. District Judge Tony Mattivi granted the stay of execution, allowing Hasan additional time to challenge his death sentence in federal court. The execution would have marked the first carried out by the U.S. military since 1961 and its first by firing squad since World War II.

Mattivi determined that the federal court had the authority to intervene and that Hasan had not unnecessarily delayed seeking judicial review. The judge noted that at least one of Hasan’s anticipated legal challenges arose after the military appeals process had concluded, leaving him without an opportunity to present the claim before a military court.

President Donald Trump approved Hasan’s execution in October. Defense Secretary Pete Hegseth initially announced plans to livestream the execution, drawing widespread criticism before Trump abandoned the proposal.

Much of Monday’s court hearing centered on whether Hasan should have sought federal intervention sooner.

Federal prosecutors argued that Hasan had ample opportunity to challenge his sentence after exhausting his military appeals. The Justice Department also raised concerns about the impact a delay would have on victims’ families, particularly those preparing to travel to Texas to witness the execution.

Attorneys with the American Civil Liberties Union’s Capital Punishment Project argued that presidential authorization was necessary before Hasan could pursue his challenge in civilian court. They indicated that preparing his habeas corpus petition could take six months.

Hasan intends to challenge whether Trump and Hegseth followed military regulations when authorizing and scheduling his execution. His attorneys have also raised concerns about possible racial bias and unlawful command influence, noting that three other men have been on military death row longer than Hasan.

Those allegations have not been resolved by the court.

Hasan, a former Army psychiatrist, was convicted in 2013 on 13 counts of murder and 32 counts of attempted murder. During his military trial, he attempted to justify the attack by arguing that he was defending the Afghan Taliban against American military operations.

The military judge rejected that defense. Hasan, who represented himself during the trial, called no witnesses and did not present a closing argument.

Hasan remains incarcerated at the military prison at Fort Leavenworth, Kansas. He has been paralyzed from the chest down since the attack, and his attorneys are seeking assurances that he will continue receiving necessary medical care.

Meanwhile, preparations for the execution had been underway in the Killeen area, where schools and offices near the military installation planned closures in anticipation of large crowds.

The Army’s restrictions on who could witness the execution had also drawn criticism from some survivors who were excluded despite experiencing lasting trauma from the attack.

Monday’s ruling does not overturn Hasan’s conviction or death sentence. Instead, it provides him an opportunity to pursue constitutional challenges in federal court before the military can carry out his execution.

For victims and their families, the ruling extends a legal process that has already stretched more than 17 years.