A Missouri court has ruled that religious liberty rights prohibit courts from interfering with a Catholic diocese’s firing of an employee for being in a same-sex marriage, which conflicts with church teaching.

The Catholic Diocese of Kansas City-St. Joseph terminated Colleen Simon’s employment in 2014, citing “irreconcilable conflict between the laws, discipline, and teaching of the Catholic Church” and her same-sex marriage to the Rev. Donna Simon of St. Mark Hope and Peace Lutheran Church in Kansas City.

A Jackson County judge ruled Feb. 16 that the court could not interfere with the diocese’s decision.

“If churches are forced to employ people who do not follow the religious teachings of those churches, the church will no longer be able to minister consistently or freely in accordance with its faith,” Jeremiah Galus, legal counsel for Alliance Defending Freedom, the organization representing the diocese, said in a formal statement.

Colleen Simon contended that the diocese led her to believe that her sexual orientation would not conflict with her employment.

According to a complaint she filed in July 2014, she was open about her sexual orientation. Before applying to be director of social ministries for the diocese’s St. Francis Xavier Parish in 2013, she said, she told the director of religious education that she was a lesbian. She said she was told “it won’t be a problem.”

When parish leadership changed, Colleen Simon said, she met with the new pastor to explain her sexual orientation and same-sex marriage. The new pastor, she said, affirmed that it was “OK.”

A few months later, in May 2014, the pastor approached Simon about an April article in the Kansas City Star’s 816 Magazine featuring the parish employee and Donna Simon, identified as her wife.

Colleen Simon said the pastor explained that, after receiving a copy of the article in the mail, the office of Bishop Robert W. Finn contacted him, and he had to ask for her resignation.

In July 2014, Simon sued Finn and the Diocese of Kansas City-St. Joseph, charging them with fraudulence for making her believe that her job was secure. She also accused the diocese of violating the Missouri Service Letter Law, which requires employers to provide a proper dismissal letter to departing employees when they request one.

On Nov. 9, 2015, Alliance Defending Freedom filed a motion for summary judgment on behalf of the diocese, arguing that the court had no business interfering in ministerial decisions.

Jackson County Circuit Court Judge Kenneth R. Garrett III agreed—in part.

Garrett noted that ruling on Simon’s claim of fraudulence “would impermissibly entangle the court in matters and decisions purely canonical, since the court must necessarily examine the religious views and practices of the diocese in an attempt to perceive the reasonableness of [Simon’s] reliance on the diocese’s representations.”

The judge’s ruling buoyed supporters of religious liberty.

“No government should force a religious institution to employ people who publicly undermine the religious mission of the institution,” Ryan T. Anderson, the William E. Simon senior research fellow at The Heritage Foundation, told The Daily Signal.

“The … court was on very firm constitutional ground to reject this attempt to drag the government into a church’s theological decisions—the very line the First Amendment says the government cannot cross,” Erik Stanley, senior counsel for Alliance Defending Freedom, said in a formal statement.

Garrett’s ruling was not a complete victory for the Diocese of Kansas City-St. Joseph, however.

Garrett did not rule on Colleen Simon’s charge regarding the service letter, saying that would be up to a jury. Rather than take the case to trial, the diocese reportedly settled soon after the judge’s decision.

Keenan Law Firm, which represents Simon, did not respond to a request for comment.