The court said the Nova Scotia Barristers' Society doesn't have the power to require law schools, such as the one proposed at Trinity Western University, to change their policies even if they may be offensive to many.
"People have the right to attend a private religious university that imposes a religiously based code of conduct," Judge Jamie Campbell said in his 139-page ruling, a month after the case was heard.
"Requiring a person to give up that right in order to get his or her professional education recognized is an infringement of religious freedom."
The society said it is reviewing the decision.
"We appreciate that Justice Campbell dealt with this matter very quickly and comprehensively," society president Tilly Pillay said in a news release.
"We are analyzing the decision and will review it with our legal counsel before we can determine what the next steps might be."
Guy Saffold, a spokesman for Trinity Western University, said school officials believed the court's decision was "exceptionally important."
"This decision is important not only to TWU's effort to launch a school of law, but also we believe it sets an extremely valuable precedent in protection of freedoms for all religious communities and people of faith in Canada," said Saffold.
The society decided last April to impose a ban on articling students from the university in Langley, B.C., until it drops a requirement to have students sign a community covenant. That agreement bans all sexual intimacy outside traditional marriages between men and women.
The society argued last month that the agreement represents unlawful discrimination against gays and lesbians under the charter and violates the province's Human Rights Act. But the university argued that the society overstepped its jurisdiction and did not have the right to refuse a student because of the school's conduct.
The university is also challenging a Law Society of British Columbia decision not to accredit graduates.
Trinity Western University's application to open a law school has been approved by the Federation of Law Societies of Canada.
But the B.C. government has withdrawn support for the school pending the outcome of multiple court challenges, delaying the start of the school indefinitely.