Public universities can refuse to recognize student groups that discriminate in their membership, the United States Supreme Court ruled Monday in a case between a University of California law school and a Christian student group that bars those who engage in “unrepentant homosexual conduct” or fail to sign a pledge of faith.

A 5-4 majority found that UC’s Hastings College of the Law in San Francisco could legally reject a chapter of the Christian Legal Society under the school’s “all-comers” anti-discrimination policy that requires recognized student groups to allow any student to join. The recognized groups gain access to campus meeting facilities, e-mail and bulletin board privileges and up to $5,000 in travel funds paid from student activity fees.

Christian Legal Society, or CLS, argued that the school violated the group’s constitutional right to free speech, expressive association and free exercise of religion when Hastings rejected it in 2004. The policy, it contended, was just a convenient excuse.

The high court split largely along ideological lines, with Justice Anthony Kennedy swinging to the court’s liberal side. For the majority, Justice Ruth Bader Ginsburg wrote that the Hastings policy is “a reasonable, viewpoint-neutral condition” for recognition.

“In requiring CLS — in common with all other student organizations — to choose between welcoming all students and forgoing the benefits of official recognition, we hold, Hastings did not transgress constitutional limitations.”

Justice Samuel Alito called the majority opinion “deeply disappointing” in a dissent joined by Chief Justice John Roberts and Justices Antonin Scalia and Clarence Thomas. Alito sharply criticized the Hastings policy as “a pretext to justify viewpoint discrimination.”

“The proudest boast of our free speech jurisprudence is that we protect the freedom to express ‘the thought that we hate,’ ” Alito wrote. “Today’s decision rests on a very different principle: no freedom for expression that offends prevailing standards of political correctness in our country’s institutions of higher learning.”

But the majority rejected the idea that the action deprived the Christian group of any rights.

“The court is saying, ‘We’re not interfering with your organizational rights,’ ” said law professor Steven Green, director of the Center for Religion, Law & Democracy at Willamette University.

“This is unlike the Boy Scouts case from years ago where the Boy Scouts had a gun to its head, going to be forced by the State of New Jersey to admit gays. CLS can still be CLS. It just may not be able to receive the government benefit.”

Bruce Simon, Hastings board chairman, called Monday’s ruling “a major victory” and defended the policy.

“The whole school is premised as a public institution on diversity and allowing an open forum,” he said. “Hastings has done nothing to step in the way of (CLS) meeting and fulfilling its goals.”

Kim Colby, senior counsel with the Christian Legal Society, noted that the Hastings policy requires an all-black student group, for instance, to admit a Ku Klux Klan member — as Leo Martinez, acting chancellor and dean of the college, acknowledged in a recent interview.

“What’s troubling is it’s so blatantly unconstitutional, but you have the liberal wing of the court willing to sacrifice a lot of the First Amendment to uphold a policy that even its defenders admitted was weird and not really a policy of common sense,” Colby said.

The high court did not rule on whether Hastings enforced its policy in a nondiscriminatory way, remanding that issue to the Ninth Circuit. Michael McConnell, a former federal judge who argued the case for CLS, said the group planned to show that Hastings does not enforce its policy across the board.

“The only thing I would really predict is, this is going to lead to a lot more conflict, tension and litigation,” said McConnell, director of the Stanford Constitutional Law Center. “The court had an opportunity simply to say, every group has a right to participate and a right to control their own leadership.”

One constitutional scholar said the ruling could be interpreted to give government wide berth to withhold benefits — including tax breaks for nonprofit groups — from those that don’t follow an anti-discrimination policy.

“I don’t think (the ruling itself) has much of an effect. They’re relatively modest benefits,” said UCLA law Professor Eugene Volokh, who agreed with the outcome. “When it comes to other things, especially tax benefits “… that could be a big deal.”

The case presented the Supreme Court with a clash of two potent principles, said William Marshall, a University of North Carolina law professor.

“One is our nation’s commitment to anti-discrimination policy, and the other is our commitment to have different kinds of groups that have different kinds of beliefs,” he said. “These are very, very difficult cases when they come.”

Contact John Simerman at 925-943-8072.