A Gay Music Teacher Got Married. The Brooklyn Diocese Fired Him.

Matthew LaBanca said he held two titles while working for the Roman Catholic Diocese of Brooklyn: music teacher and parish music director.

Off and on for 16 years, he played the organ and led the choir at Corpus Christi Church in Queens. In 2015, he also began working at St. Joseph Catholic Academy, also in Queens, where he taught children to sing and play instruments like the recorder or the drums.

But, after Mr. LaBanca married his boyfriend in August, he learned that a group of church leaders were debating his future and were pondering whether he also had another job within the Catholic church — that of “minister” — though he has no formal religious training and his jobs did not involve religious education or preaching.

On Oct. 13, the Diocese of Brooklyn, which encompasses the boroughs of Brooklyn and Queens, fired Mr. LaBanca because the church does not condone same-sex marriage.

It is illegal for employers to discriminate on the basis of sexual orientation under federal, state and New York City laws, but religious institutions are allowed to favor members of their faith in employment settings like schools and houses of worship.

That loophole does not permit them to discriminate on the basis of traits like sex or sexual orientation unless the job in question is a ministerial position. That provides the legal basis by which the Catholic Church can refuse to employ women as priests, but in recent years it has increasingly been used to fire people in same-sex civil marriages from jobs that have not traditionally been seen as part of the clergy.

In a statement concerning the decision, the diocese referred to Mr. LaBanca as a “music teacher and minister” and explicitly said he was fired because his marriage violates the requirement that ministers comply with church teachings.

“Despite changes to New York State law in 2011 legalizing same-sex marriage, Church law is clear,” the diocese statement said in a statement. It added, “In his case, it has been determined that he can no longer fulfill his obligations as a minister of the faith at either the school or the parish.”

When he was fired, Mr. LaBanca was offered a $20,000 severance package if he signed a confidentiality agreement that would bar him from discussing his firing, he said. He declined.

Instead Mr. LaBanca, 46, has publicized his termination to bring attention to the church’s use of the legal loophole to target L.G.B.T. people while other employees whose lives do not align with church teachings go unpunished.

“There are many people whose lives don’t conform to church teachings,” he said. “People who don’t go to church on Sunday. People who are on birth control. People who are divorced and get remarried.”

He married his longtime partner, Rowan Meyer, an actor, on Aug. 1 at a ceremony officiated by his father, who got ordained online through the Universal Life Church. Mr. LaBanca said it was “the most beautiful day of my life.”

He described himself as a lifelong Catholic whose faith had been deeply shaken by the events of the last several weeks. He said he kept thinking about the pastoral approach toward L.G.B.T. people adopted by Pope Francis.

“The idea that we should uphold the Catholic faith — well, there is a lot of ambiguity right now about what that means based on what the pope himself has said about acceptance,” he said.

The justification for the firing of Mr. LaBanca and other Catholic schoolteachers like him is still subject to legal debate, experts said.

“There are absolutely no government rules around who can be deemed a minister, so it’s a really, really broad exemption,” said Sharita Gruberg, the vice president of L.G.B.T.Q. research at the Center for American Progress, a liberal think tank. “The courts are going to have to continue to answer, is this individual a minister or not?”

The Supreme Court ruled last year that federal employment discrimination laws do not apply to teachers at religious schools if their duties include religious activities, like praying with students. But it also found in a separate case that L.G.B.T. people were covered by federal civil rights law that banned workplace discrimination on the basis of sex.

“The Supreme Court has taken a very broad view of the ministerial exception,” said Katherine M. Franke, the director of the Law, Rights, and Religion Project at Columbia Law School. “The boundary question is when is an employee actually engaging in ministry, as opposed to a private religious school where someone teaches math or science or literature?

“That is the question, what does it mean to be engaged in ministry?” she added. “It can’t simply be that you’re employed by a religious institution.”

In its statement on Mr. LaBanca’s firing, the diocese provided an excerpt from its employment contract for teachers, which says: “The teacher is essential to the ministry of conveying the Faith and acknowledges that she/he is a minister of the Roman Catholic Faith.”

Mr. LaBanca said the church’s description of his role was “extremely subjective” and not “minister with a capital M,” and that he signed no such contract for his job at the parish.

“I would say that’s a strong label for what I do,” he said. “I would never have labeled myself a minister. And at school I was Mr. Matt, or Mr. Matthew, I was never called a minister.”

His work with the diocese began in 2005 as the sort of pay-the-bills side gig that many actors in New York get. It soon evolved into a passion and his primary source of income and health insurance.

He worked as the music director at Corpus Christi in Woodside from 2005 to 2007, then left to perform in theater shows, including the Broadway production of “Young Frankenstein,” before returning to the job in 2012. Three years later he began his job at St. Joseph Catholic Academy in Astoria.

Mr. LaBanca said he did not keep his sexual orientation a secret at work, although he “didn’t make a big deal of my wedding at all” because he was aware of church teaching on homosexuality.

“It’s not as though I am closeted,” he said. “I respect that some people in the community may not understand or may not be able to see beyond what their catechism or their culture or their parochial mind-set may have informed them about this issue. I was respectful in that regard, but people knew I was gay.”