A Massachusetts court has ruled that a Catholic high school violated a gay man’s rights when it revoked a job offer after he informed them he was in a same-sex marriage.

On Wednesday Massachusetts Superior Court Justice Douglas Wilkins rejected Fontbonne Academy’s argument that it was obliged to model the teachings and values of the Catholic Church, which is opposed to same-sex marriage, reports the Associated Press.

Writing at National Catholic Register, Matthew Archbold described the ruling as “troubling” and “a disaster for all religious institutions.”

“[T]he judge in this case…rejected the distinction that the school attempted to make which was that their decision had nothing to do with the man’s sexual orientation but about the Church’s teaching on marriage,” he explains.

Matthew Barrett – who was offered a job as food services director at the school in 2013 — sued the Boston-area girls’ high school last year, claiming that he was discriminated against because of his sexual orientation when the job offer was revoked after he listed his “husband” as his emergency contact on a form.

Wilkins rejected the argument that Fontbonne’s hiring decisions are protected by the First Amendment right to freedom of religion. He said Barrett’s job description as a food services director did not include presenting the teachings of the Catholic faith.

“As an educational institution, Fontbonne retains control over its mission and message. It is not forced to allow Barrett to dilute that message, where he will not be a teacher, minister or spokesman for Fontbonne and has not engaged in public advocacy of same-sex marriage,” Wilkins wrote in a ruling issued Wednesday.

Additionally, the judge said that since Fontbonne allows non-Catholic students and staff, the school did not qualify for a religious exemption from Massachusetts’ anti-discrimination law, stating the law applied only to institutions that “limit membership, enrollment, admission, or participation to members of that religion.”

“I’m ecstatic,” Barrett said following the ruling. “What happened to me was wrong, and I truly hope it doesn’t happen to anyone else.”

According to AP, Barrett’s attorney – Ben Klein of Gay & Lesbian Advocates & Defenders – said Fontbonne could be liable to pay damages for Barrett’s lost wages.

Archbold, however, continues that the judge “took it upon himself to decide what was and wasn’t a part of the Catholic school’s religious mission” when he said Barrett’s job had nothing to do with the Catholic school’s religious mission.

“[T]he U.S. Supreme Court, in Hosanna-Tabor v. Equal Employment Opportunity Commission, severely restricted the right of the government to decide for a religious school who is and who is not considered a minister,” writes Archbold. “The Supreme Court ruled unanimously, specifically saying that it is ‘impermissible for the government to contradict a church’s determination of who can act as its ministers.’”

Fontbonne said it would consider its options following the court’s decision.