A court ruled Thursday against a Texas high school that was barring two Catholic students from extracurricular activities due to their refusal to cut their hair, which they had grown out for religious reasons.

The ruling from the United States District Court, Southern District of Texas in the case Gonzales v. Mathis Independent School District granted Cesar and Diego Gonzales a religious accommodation that will allow them to once again participate in school activities while the case continues its way through the court system.

The Gonzales brothers had been banned from participating in interscholastic sports and clubs at Mathis Middle School since 2017, because they have a long, braided strand of hair, which the school says is a violation of the district’s dress code, which forbids long hair for males.

When Cesar Gonzales was an infant, he contracted meningitis and became very ill. While he was sick, his parents promised to God that should he recover, they would allow a piece of his hair to grow forever uncut. They made a similar promise to God when they were expecting Diego, and grew out a portion of his hair as well. This practice, associated with Mexican Catholicism, is known as a “promesa.”

The Mathis Independent School District allowed the Gonzales brothers to wear their hair with the braid through the sixth grade. When the boys entered the seventh grade, they were told to cut it, or else they could not join the football team or clubs like the science club or student council. The school board rejected the family’s explanation that their longer hair was part of their religious beliefs. The Gonzales brothers would only be allowed to rejoin their teams and clubs if they cut their hair.

The family sued in 2018, alleging that this was a violation of the Religious Freedom Restoration Act. The school district has refused to budge on its insistence that the boys cut their hair.

Religious freedom advocates cheered Thursday’s ruling.

“No student should be bullied or punished at school because of his faith,” Luke Goodrich, vice president and senior counsel at the Becket Fund for Religious Liberty, told CNA. “This is a very easy request to accommodate, and the law requires the school district to do so.”

The Becket Fund for Religious Liberty sent a letter to the Mathis ISD in July, requesting that the boys be allowed to play in sports and join clubs.