A federal court this week rejected a gay music director's claim that he was unlawfully fired from an Illinois Catholic church because of his sexuality.

Colin Collette sued his employer, Holy Family Church in the Chicago suburb of Inverness, after he was dismissed following news of his 2014 engagement. Collette had served as the church's director of music and director of worship for 17 years.

U.S. District Judge Charles Kocoras on Tuesday sided with Collette's employer, finding in a seven-page ruling that Collette's position was ministerial in nature and therefore exempted from civil rights laws.

“By playing music at church services, Collette served an integral role in the celebration of mass,” Kocoras wrote. “Collette’s musical performances furthered the mission of the church and helped convey its message to the congregants. Therefore, Collette’s duties as Musical Director fall within the ministerial exception.”

Collette, who waited two years before filing his suit, told NBC Chicago in 2014 that he did not hide his relationship from co-workers because Holy Family Church positioned itself as “welcoming to all.”

“Everybody was welcome. That was our hallmark. All are welcome. Well, that's all changed now. That's become a lie,” Collette said at the time.

The Archdiocese of Chicago said in firing Collette that worship ministers “are expected to confirm their lives publicly with the teachings of the Church.”