MONTGOMERY, Ala. (AP) – An appeals court has ruled against Native American inmates in Alabama fighting for the right to wear long hair in accordance with their religious beliefs.

The 11th U.S. Circuit Court of Appeals court this week upheld an Alabama prison policy requiring male inmates to keep their hair cut short. The federal judges ruled that the Alabama Department of Corrections had security and hygiene reasons for the policy. Judges said the court could not force Alabama to accept inmates with long hair even though prisons across the country had done so safely.

Inmates had told the court that their long hair has deep religious significance, and they wanted to keep their hair unshorn because of their beliefs.

“Their sacred and ancestral core religious traditions are at stake,” said the inmates’ attorney, Mark Sabel of Montgomery.

The prison department did not immediately respond to an emailed request for comment on the decision. The department had argued that long hair was a hygiene risk and could be used to conceal weapons and contraband.

The long-running lawsuit was first filed in the 1990s and has been before the 11th Circuit three times.

The U. S. Supreme Court in February kicked the case back for review after ruling the previous month that Arkansas had violated the religious rights of Muslim inmates by forbidding them to grow beards.

Sabel said he thought the 11th Circuit decision was in conflict with the Arkansas case.

Most states and the Federal Bureau of Prisons allow long hair or a religious exemption on grooming policies, said Joel West Williams, staff attorney with the Native American Rights Fund.

“The evidence is that 39 jurisdictions allow long hair and do so safely,” Williams said.

The appeals court said many well-run prisons see the benefit of allowing inmates to follow the grooming practices of their religion but that Alabama had to decide for itself if it was worth the risks.

The department of corrections “may, of course, decide in the future that these costs and risks might be worth absorbing, especially in view of the high value that long hair holds for many religious inmates,” the judges wrote.

Sabel said he is considering his next step, which could include asking for a hearing by all 11th Circuit judges or another appeal to the U.S. Supreme Court.