A U.S. Army appeals court ruled that Nidal Hasan must have his beard shaved before standing trial for the 2009 shooting rampage that killed 13 people at Fort Hood in Killeen, Texas.

Hasan’s trial has been delayed for months while the court heard motions from the prosecution and defense teams. Hasan, who is Muslim, has contested a forced shaving, citing the beard as a religious liberty, according to Reuters. Hasan was an Army major at the time of the shootings.

Along with the 13 killed, 32 other people were wounded on Nov. 5, 2009, when the alleged gunman began shooting at soldiers who were undergoing medical tests before being sent to Iraq. If Hasan is convicted, he could face the death penalty.

“In front of a military panel, it is undeniable that failure to comply with Army grooming regulations would cast him in a negative light," U.S. Army Court of Criminal Appeals judges ruled in a 4-2 vote, according to NBC News wire services. “The military judge has the authority to prescribe the proper uniform for trial.”

Beards are forbidden in the Army, but religious exceptions are allowed. Prosecutors in the case have argued that Hasan has been a practicing Muslim for more than 20 years and has never cited an issue with the Army’s grooming standards until now.

The defendant, who is 42, has had his religious sincerity questioned, and the Associated Press reported he has been fined six times for attending pretrial hearings with the beard.

Hasan’s defense attorney, Capt. Kristin McGrory, said the military normally only forcibly shaves inmates for health or safety reasons. “The fact that he’s wearing a beard does not materially interefere with the course of the trial,” she told the military judges.

Although the attack Hasan is accused of carrying out happened almost three years ago, the defendant was only released from the hospital in September of this year, the Los Angeles Times reported.  Hasan was paralyzed from the chest down after he was shot four times in the shooting spree. He now uses a wheelchair and is housed in a jail 80 miles away from Austin, Texas.