[Editor’s note: An earlier version of this article incorrectly identified Mercedes Lopez Blanco, a spokesperson for the Archdiocese of New York, as an attorney. The error has been corrected.]

In what a defense attorney described as a “a victory for schools of all faiths,” a New York court ruled Friday that St. Anthony School in the Archdiocese of New York was within its rights in not renewing the contract of a lay principal judged to be ineffective in promoting the school’s Catholic values.

Joanne Fratello, the former principal who held that role from 2007 to 2011, had filed suit against the school and the archdiocese in 2016, with her lawyer arguing that someone hired for an essentially “lay” capacity should not be included under the “ministerial exemption,” an article of U.S. law allowing faith groups to choose personnel on the basis of their religious beliefs.

That lawyer, Michael Diederich, was open about his disdain for the Church. He wrote a scathing reply to a “friend of the court” brief filed by the Orthodox Church of America on behalf of the archdiocese, where he expressed contempt for “organized religion” as a threat to “enlightened rationality.”

Fratello should have been kept in her position by the archdiocese because as a secular employee, she could protect students against religious indoctrination, he argued.

Attorneys for the archdiocese, however, argued that serving as a Catholic school principal does involve religious responsibilities.

“It is important that church-sponsored schools like St. Anthony’s be able to ensure that each student receives the best education in math, science, art as well as the Catholic faith,” archdiocesan spokesperson Mercedes Lopez Blanco said last March.

“To do that, we must have the freedom to choose leaders – without government interference – who are dedicated to our mission,” Blanco said.

The ruling Friday was an appeal of an earlier decision by a judge in the 19 United States District Court for the Southern District of New York to summarily dismiss Fratello’s lawsuit, on the grounds that her position is covered by the ministerial exception.

A three-judge panel for the Second Circuit Court of Appeals upheld that decision.

“We conclude that the plaintiffʹs claims are barred because she is a minister within the meaning of the exception,” the panel concluded.

“Although her formal title was not inherently religious, the record reflects that, as part of her job responsibilities, she held herself out as a spiritual leader of the school and performed many religious functions to advance its religious mission.”

Further, the appeals court found that “judges are not well positioned to determine whether ministerial employment decisions rest on practical and secular considerations or fundamentally different ones that may lead to results that, though perhaps difficult for a person not intimately familiar with the religion to understand, are perfectly sensible—and perhaps even necessary—in the eyes of the faithful.

“In the Abrahamic religious traditions, for instance, a stammering Moses was chosen to lead the people, and a scrawny David to slay a giant,” the judges said.

Friday’s ruling leaned heavily on a 2012 U.S. Supreme Court decision called Hosanna-Tabor Evangelical Lutheran Church and School v. Equal Employment Opportunity Commission, in which the court held unanimously that federal discrimination laws do not apply to religious organizations’ selection of religious leaders.

Defense lawyers celebrated the outcome.

“The court saw right through this blatantly anti-Catholic lawsuit, agreeing with the Supreme Court that the church, not the state, should pick religious leaders,” said Eric Rassbach, deputy general counsel at Becket, a non-profit religious liberty law firm, who argued the case for St. Anthony’s and the Archdiocese.

“Now St. Anthony’s can go back to giving their students a quality education in the arts, sciences and faith,” he said.