Updated

A Massachusetts judge has ruled that an all-girls Catholic school violated state anti-discrimination law by rescinding a job offer to a gay man in a same-sex marriage.

Matthew Barrett was offered a job as Fontbonne Academy's food services director, but the offer was withdrawn after he listed his husband as his emergency contact.

Barrett sued. A judge ruled Wednesday that the school discriminated against him based on sexual orientation and gender. The judge rejected Fontbonne's claim that it should be exempt from the law because it would infringe on free exercise of religion. The Catholic church opposes same-sex marriage.

The judge said the exemption applies only if a religious organization limits admission. Fontbonne is open to students and employees of all faiths.

Fontbonne's attorney did not immediately return a call seeking comment.