A federal judge has ruled that a Christian student organization at a public university has a constitutional right to ban LGBTQ leaders.

In 2017, the Business Leaders in Christ (BLinC) at the University of Iowa lost its Registered Student Organization (RSO) status after a gay student who wanted to be the groups vice president filed a complaint.

The organization said that anyone can be a member of the group, but leadership must agree to a statement of faith that says, among other things, that they will “embrace, not reject, their God-given sex.”

“Every other sexual relationship beyond this is outside of God’s design and is not in keeping with God’s original plan for humanity,” the statement says.

The University of Iowa requires all campus organizations to follow its Human Rights Policy, which bans discrimination on the basis of a number of factors, including sexual orientation.

Related: Christian university expels student for marrying her same-sex partner

While the group could still exist without RSO status, they lost access to university resources like student activities fees and use of classrooms.

BLinC filed a lawsuit that argued that their First Amendment rights had been violated. Discrimination against LGBTQ people, they argued, was intrinsic to their religious beliefs.

Last year, the Department of Justice filed a statement of interest siding with BLinC.

Judge Stephanie Rose ruled in favor of BLinC this past Wednesday, finding that the school inconsistently applied its Human Rights Policy and engaged in viewpoint discrimination.

Rose cited several other organizations on campus, like a Chinese students’ association and a group for black LGBTQ people, which BLinC said were allowed to restrict membership to an oppressed minority group.

The university said that some of those groups are still on campus due to “administrative oversight,” and others because providing a safe space for oppressed groups advances the school’s educational mission.

“The Constitution does not tolerate the way Defendants chose to enforce the Human Rights Policy,” Rose wrote in the ruling.

“Particularly when free speech is involved, the uneven application of any policy risks the most exacting standard of judicial scrutiny, which Defendants have failed to withstand.”

A University of Iowa spokesperson said that they are still reviewing the ruling.