FORT BELVOIR, Virginia — Lawyers argued in a US military court Thursday over whether the soldier accused of the Fort Hood massacre can keep his beard despite objections from the judge overseeing his court-martial.

A government attorney insisted Major Nidal Hasan, charged with the November 2009 shooting spree, had to conform to US Army regulations prohibiting beards and that the judge in the case was well within his rights to issue an order for the suspect to be forcibly shaved.

"This is akin to wearing a sign that says 'F-you judge,'" Captain Kenneth Borgnino told the Army Court of Criminal Appeals.

Hasan's bushy "unkempt" beard is a "flagrant violation" of military grooming standards and the judge had clear authority to maintain decorum in his courtroom, he said.

"It is an offense to uniform, to the army... to the panel (jury), to members of the gallery and to the victims," Borgnino added.

The beard could also be interpreted as a defiant act by Hasan to associate himself with Islamic extremists, the lawyer said.

With legal disputes over Hasan's beard holding up the trial, a seven-judge panel listened to more than an hour of arguments over whether the accused had to show up in court clean-shaven.

A decision is expected within days.

Hasan's lawyers said the judge presiding over the court-martial, Colonel Gregory Gross, had no legal right to order their client to be forcibly shaved and that the judge's stance had undermined his impartiality.

"We believe the military judge exceeded his authority," Lieutenant Colonel Kris Poppe said.

"Forcible shaving exceeds the authority of the military judge."

Hasan has said he grew the beard out of devotion to his Islamic faith and his lawyers say orders demanding that he be shaven violate his civil liberties under the Religious Freedom Restoration Act adopted in 1993.

The defense attorneys also asserted that Hasan's beard had not in any way interfered with the court-martial proceedings.

"He has sat through several proceedings throughout this trial and not disrupted the proceedings," said Captain Kristin McGrory.

Hasan, who was shot by police officers during the rampage and left paralysed from the neck down, was not in the courtroom Thursday. He has attended hearings in Texas, where his court-martial is due to take place.

Hasan is accused of opening fire at the sprawling Fort Hood army base on November 5, 2009, in an attack that killed 12 soldiers and a civilian, and wounded 32 others. If convicted, he faces a possible death sentence.