Plans to establish Canada’s first religiously-affiliated law school hit a roadblock after the nation’s high court ruled last week that the evangelical school could be denied accreditation because of a requirement that students adhere to a “community covenant” barring sex outside of heterosexual marriage.

Trinity Western University’s covenant would deter gay, lesbian, bisexual and transgender students attending, and the legal profession has a right to promote diversity and ensure equal access, the court ruled in a 7-2 decision that has drawn criticism and spurred debate over religious freedom in Canada.

By contrast, law schools attached to religious universities in the United States have generated relatively little controversy in recent years, despite the fact that more than a quarter of the American Bar Association’s 204 accredited schools have religious ties. The ABA more than three decades ago added an accreditation standard that allows religiously affiliated law schools to give preference to applicants and employees of their faith, so long as the schools disclose their policies at the outset. The rules clarify that law schools may pursue their religious missions only to the extent those activities are protected under the First Amendment.

➤➤ Stay on top of developments and trends in legal education with Ahead of the Curve by Karen Sloan, a new weekly briefing from  Sign up here and get next week’s email update straight to your inbox.

Those changes have helped religious law schools in the U.S. sidestep the issue the Supreme Court of Canada grappled with last week, though questions of discrimination on religious campuses do crop up from time to time. In 2016, the ABA investigated a complaint brought by an alumni that Brigham Young University J. Reuben Clark Law School violated its nondiscrimination standard by expelling ex-Mormons and requiring students to sign an honor code prohibiting homosexual behavior. The ABA dismissed the complaint without taking action.

John Boersma, a Ph.D. candidate at Louisiana State University who in 2016 published an article in the BYU Law Review about Trinity Western’s case and the legal status of religious law schools in the U.S., said the long history of religious law schools here has played a large role in their widespread acceptance.

“Canada, in contrast to the U.S., has never had a religious law school,” Boersma said. “[Trinity Western’s] proposed law school was, in this way, a novelty that was being proposed in a time in which the culture in both Canada and the U.S. was undergoing a fundamental shift in regard to morality and marriage norms. In contrast, religious law schools have long existed in the U.S. As a result, religious law schools are much more firmly ensconced in the cultural history of the U.S. in a way that works to their advantage.”

The 52 religiously affiliated law schools in the U.S. exist on a spectrum. At a small number of campuses, religion is front and center and woven into much of the curriculum. At other schools, the religious mission is present but not central to the education program and campus atmosphere.

Liberty University School of Law, for example, promises to “teach you how to integrate faith and reason into your field.” Through a clinic and policy center, students have the opportunity to aid the work of Liberty Counsel, a nonprofit organization that brings litigation an behalf of evangelical causes.

Catholic University of America Columbus School of law touts its “spiritually nourishing resources” that include a daily mass on campus and student organization devoted to Catholic social thought and teaching.

Seven U.S. law schools had community covenants similar to Trinity Western’s as of 2015, according to Boersma’s article. (The covenants generally forbid students from engaging sex outside of marriage, those some also specifically bar homosexual activities.)

The last time a law school faced a major accreditation issue related to its religious mission was 1981, when the ABA initially denied accreditation to Oral Roberts University’s O. W. Coburn School of Law because it required students and faculty to sign an oath of religious faith. (Oral Roberts is a fundamentalist Christian campus in Tulsa, Oklahoma.)

The ABA deemed the oath to be a violation of its accreditation standard prohibiting discrimination on the basis of race, sex or religion. The law school sued, alleging the ABA had violated its First Amendment rights, and a district court judge issued a preliminary ruling to that effect. But the case was cut short after the ABA amended its accreditation standards to give more freedom to religious schools, so long as the schools’ activities are protected by the First Amendment.

Oral Robert’s law school obtained accreditation later that year but closed in 1986. (The school’s law library and some of its faculty relocated to what is now Regent University School of Law—a Christian law school in Virginia.)

Today, the ABA’s standards prohibit discrimination against applicants, students and employees based on “race, color, religion, national origin, gender, sexual orientation, age or disability. It is poised to add “gender identity” to that list in August, which will offer specific protection for transgender individuals.

However, the nondiscrimination standard allows law schools with religious affiliations to give admissions preference to “persons adhering to the religious affiliation or purpose of the law school.” If a school has a religious preference in admissions or hiring, it must disclose that policy before students enroll or employees sign on the dotted line.

“There was a lot of discussion that led to the compromise that was eventually reached: If it’s essential to your religion, you may be able to do it, as long as it’s protected by the First Amendment,” said Barry Currier, the ABA’s Managing Director of Accreditation and Legal Education. “But if you’re going to do that, then you should give notice to people so they know the environment into which they’re about to enter.”

Even though a religious preference is allowed under the ABA’s rules, religious law schools may not deny admission on the basis of race, religion and the other specified classes. Any consideration of religious affiliation in admission and hiring decisions is permissible only to the extent that it is protected under the First Amendment, according to the standard.

An interpretation of ABA standard clarifies that religious law schools need not act “inconsistently with the essential elements of its religious values and beliefs,” concerning sexual orientation. For instance, they don’t have to support LGBT advocacy organizations if that conflicts with the school’s religious values.

“We’re in the middle of a delicate balance between freedom of religion and—for lack of a better term— privacy considerations,” Currier said, while allowing that that religious law school standard isn’t black and white. “It’s certainly a tough area.”

Boersma said he believes the ABA has skirted the issue of law schools’ religious freedom by allowing religious-based admissions policies only to the extent guaranteed by the First Amendment. He would like to see accreditation rules that allow more leeway for religious schools.

“My own view is that the ABA should adopt a standard recognizing the value of maintaining diverse perspectives and approaches to legal education,” he said.

Trinity Western’s planned law school at its British Columbia campus has a long and tortured history. It was in the works for 20 years before a final plan was completed in 2012. But the Law Society of British Columbia in 2014 reversed an earlier decision to accredit the school amid opposition from lawyers who said the mandated community covenant would discriminate against gay students and unmarried couples. (In Canada, law school accreditation is issued by provincial law societies as opposed to a national entity such as the ABA.) Law societies in several other provinces also denied the school accreditation, and Trinity Western sued in three different courts, claiming the denial of accreditation violated students’ rights to freedom of religion and expression. The lower courts split on the issue, prompting the Supreme Court of Canada to rule against the school last week.

“In our respectful view, the [law societies] decision not to accredit Trinity Western University’s proposed law school represents a proportionate balance between the limitation on the Charter right at issue and the statutory objectives the [law societies] sought to pursue,” reads the majority opinion.