IOWA CITY, Iowa — A federal judge has ruled that the University of Iowa was wrong to strip a Christian student group of its registered status after the organization barred a gay student from a leadership position.

U.S. District Judge Stephanie M. Rose on Wednesday granted a permanent injunction banning the university from rejecting the status of the group, Business Leaders in Christ, The Des Moines Register reported.

Rose found that the university had unevenly applied its human rights policy by allowing other groups to limit membership based on religious views, race, sex and other protected characteristics.

"Particularly when free speech is involved, the uneven application of any policy risks the most exacting standard of judicial scrutiny, which the defendants have failed to withstand," she said.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Business Leaders in Christ member Jake Estell said the group is happy with the outcome.

"This victory reinforces the commonsense idea that universities can't target religious groups for being religious," he said.

The university said it plans to adhere to the court's decision.

The university revoked the group's registration in November 2017 after the group barred a student from holding a leadership position after he disclosed that he was gay. The university said it has a right and obligation to ensure an open and nondiscriminatory environment on campus.

The registration loss meant Business Leaders in Christ could no longer reserve campus meeting space, participate in student recruitment fairs, access funds from student activity fees or use university-wide communication services.

Business Leaders in Christ sued the university, arguing that its membership is open to all students but that leaders must affirm a statement of faith that includes rejecting homosexuality.

Rose in January 2018 ordered the group to be temporarily reinstated while the lawsuit was pending. The U.S. Justice Department in December filed a "statement of interest" backing the group, arguing that the university had violated its free speech and assembly rights.

FOLLOW NBC OUT ON TWITTER, FACEBOOK & INSTAGRAM