Image copyright Getty Images Image caption Texas inmates (FILE)

Three Native American prisoners in Texas have successfully sued the state's prison system for the right to grow long hair for religious reasons.

The ruling only applies to these three inmates but could affect the more than 5,000 Native American prisoners in the state, the Houston Chronicle reported.

The men argued that long hair connects them to their creators, but the state said it would pose a security threat.

A prison official said that the state would consider appealing the ruling.

The ruling issued by US District Judge Nelva Gonzales Ramos in Corpus Christi last month came after a three-day trial, and only applies to the prisoners in the McConnell Unit near Beeville.

Cherokee man Robbie Dow Goodman, 55, who is the lead plaintiff in the case, said in court that his hair is "just like the roots of a tree".

"It connects us," he said declaring that being forced to cut his hair feels like "getting beat up".

Raymond Cobb, 42, said he wants a braid to avoid being rejected by his ancestors when "crossing over" after death.

Prison officials fought the case for nearly seven years since it was first brought in 2012 by the men, who have been convicted for serious violent crimes.

In court, the state claimed that long hair would pose a security risk, as it could be used to identify gangs, smuggle contraband and pose a danger to health.

"Although both male and female offenders have been caught with all types of contraband, the types of contraband that female offenders are most commonly caught with is cosmetics," the state wrote in court filings.

"Male offenders are much more likely to smuggle contraband that is dangerous, such as cellphones, drugs, and sharpened weapons intended for stabbing."

The state argued that it could harbour lice, increase the chance of overheating and lead to more suicides because a female inmate had once tried to smother herself with her own hair.

Prison spokesman Jeremy Desel told the Chronicle: "While we do not agree with the finding of this court, we fully respect the legal process."

Mr Desel later told BBC News that the Texas Department of Criminal Justice had "no comment on the ruling or any future plans associated with it".

The newspaper reports that after the final judgment was ruled in late February, the state has 30 days to issue an appeal.