A US federal judge has ordered a pause in the execution of Fort Hood attacker Nidal Hasan, just days before he was scheduled to be killed by a military firing squad.

Hasan, a former US army psychiatrist, has admitted to the 2009 attack in Texas, during which he shot and killed 13 unarmed soldiers. But he is attempting to file a legal petition challenging his punishment, arguing "unlawful command influence" by members of the Trump administration.

Survivors of the attack, and relatives of victims, reacted with exasperation - one of them calling it a "slap in the face".

The delay marks another twist in the case, after a plan to livestream Hasan's execution was cancelled by President Donald Trump.

The president had approved the execution by firing squad in October.

Days later, Defence Secretary Pete Hegseth said it would be livestreamed, which sparked an outcry before that was reversed.

Hasan, a former US army psychiatrist, had asked US District Judge Tony Mattivi - in Kansas, where he is imprisoned - to delay his 3 December execution while he made his appeal.

He argued that his constitutional rights were violated "due to unlawful command influence" of Trump and Hegseth, "who are driven by unlawful racial and religious animus."

Lawyers for the government argued on Monday that the timing was too close to Hasan's execution for him to file his petition.

But Mattivi ruled that Hasan did not deliberately delay filing his request for review, and said Hasan should be given time to defend his claims.

Mattivi, who was appointed to his role by Trump, wrote: "We are a nation of laws. Those laws protect everyone who comes before a court, including people convicted of the worst crimes."

Hasan's execution has been delayed until at least 1 June 2027, the date by which he must file his legal petition.

US Attorney General Todd Blanche said moments after Mattivi's ruling that the government had filed an appeal against his "last-minute" order.

"Hasan offers no justification for his delay in filing a habeas petition, nor can he establish any likelihood of success on the merits of his yet-unfiled petition," Blanche wrote on X.

A legal expert gave his interpretation of Mattivi's ruling to the Associated Press (AP) news agency, saying: "The decision today is not that the trial was unfair or that the death sentence was unfair. It was, should he have the time to develop those arguments?"

The expert, Prof Brenner Fissell from Villanova University, said the judge's decision could delay the execution by years.

Fort Hood survivor supports gunman's execution by firing squad but questions livestream

Trump calls off livestream of Fort Hood attacker's execution by firing squad

People who survived the shooting, or lost relatives in the attack, voiced their disappointment. Some of them had been due to observe the execution on Thursday.

Alonzo Lunsford, a survivor, spoke to local TV station KWTX. He said of Hasan: "I no longer give him that power of control to have any kind of effect over my emotions personally. Where my emotions were sped up is for the families of the fallen."

Julia Wilson, another survivor, told the station: "He's had 13 years essentially to go down this pathway, so why all of a sudden are we jumping off on this at the very last minute?"

Marikay DeCrow, whose husband Justin DeCrow was killed in the attack, told AP she was devastated, and that the ruling was "a slap in our face".

DeCrow was due to travel to Kansas from Indiana this week to witness the execution. "I wanted to see this through for Justin," she said. "I needed closure and that judge just took it all away."

The United States Disciplinary Barracks in Kansas, where Nidal Hasan is being held on death row

Hasan represented himself in court with support from the American Civil Liberties Union.

He is being held at the military prison at Fort Leavenworth in Kansas. Thursday's scheduled execution by the US military would have been the first in more than 60 years.

In 2009, Hasan opened fire in a crowded medical building where deploying soldiers were awaiting check-ups and vaccines. In addition to those killed, 32 others were injured.

The scene ended when officers shot Hasan in the back, paralysing him from the chest down. He was in court on Monday in a wheelchair.

In court, he had previously said that he was the gunman and apologised for "any mistakes".

He said during his court martial in 2013 that he believed he was protecting Muslims and the Taliban in Afghanistan from the US military.

The killings on 5 November 2009 were the deadliest ever non-combat attack on an American military base.

US military law requires that a military execution be approved by the US president, which Trump did in October.

It also requires appellate review, in which a higher court examines the decision and determines whether it can proceed.