The U.S. Army psychiatrist charged in a deadly shooting rampage has told a judge he grew a beard because his Muslim faith requires it.

Maj. Nidal Hasan spoke in court for the first time Thursday since showing up with a beard in violation of Army regulations in June. The judge threatened to have him forcibly shaved.

Hasan says he isn't trying to disrespect the judge's authority. But the judge held Hasan in contempt for a sixth time and sent him to a nearby room to watch proceedings on closed-circuit television.

Hasan faces the death penalty if convicted in the 2009 attack that killed 13 and wounded more than two dozen others in Texas.