BEEVILLE, Texas — Three male Native American inmates in Texas will be allowed to grow their hair long as an expression of their religious beliefs after winning a lawsuit against the state prison system.

U.S. District Judge Nelva Gonzales Ramos' ruling last month only affects the three inmates at the McConnell Unit near Beeville, but their arguments could apply to future lawsuits involving any of the more than 5,000 Native American prisoners in the state, the Houston Chronicle reported.

Texas is considering an appeal, according to prison spokesman Jeremy Desel.

The inmates' nearly seven-year lawsuit against the Texas Department of Criminal Justice argued that Native American spiritual beliefs regard hair as an extension of the soul, and that hair should only be cut when in mourning. The inmates claimed that the prison system's rules requiring men to keep their hair short or face punishment were an unfair violation of religious freedom under the Religious Land Use and Institutionalized Persons Act.

The three men have all been behind bars for decades, serving time for crimes such as murder and sexual assault. They haven't faced major disciplinary infractions in years.

Raymond Cobb, a Walker County man of Native American descent who was part of the lawsuit, said he wanted to grow his hair long and braid it to avoid risking rejection from his ancestors when "crossing over" after death.

The lead plaintiff and a Cherokee man, 55-year-old Robbie Dow Goodman, said his long hair connected him to his Creator.

"It's just like the roots of a tree," he said at trial. "It connects us."

Attorneys for the state argued that allowing male prisoners to have long hair hinders inmate identification and could present a suicide risk after a female prisoner tried to smother herself with her hair. Corrections officials worried that inmates would be able to hide contraband in long hair, attorneys said.

The department also claimed long hair could symbolize gang affiliation, harbor lice or increase the likelihood of inmates overheating in uncooled units.

Security and hygiene concerns were also cited in a similar case in 2015, in which an appeals court ruled against Native American inmates in Alabama who fought for their right to wear long hair.

"Inmates being able to fully express and practice their religion is rehabilitative and reduces recidivism," said attorney Steven Messer, who represented the Texas inmates. "It's just good policy."