Catholic Charities groups in Illinois announced on Tuesday they were “reluctantly” dropping their fight against gay adoptions, the AP reported.

After Illinois approved a civil unions law that recognizes gay and lesbian couples, Catholic Charities dioceses in Joliet, Springfield and Belleville told the state that it could not accommodate prospective fosters parents in a civil union. The group maintains that the teachings of the Catholic Church define marriage as a heterosexual union.

Catholic Charities sued the state after it ended over $30 million in annual contracts. It claimed it was exempt from the law under its religious protections clause and that the state had violated the property rights of Catholic Charities when it refused to sign new contracts.

The state argued that the law's religious exemptions only applied to clergy who refused to officiate over the civil unions of gay couples.

In its motion to dismiss, Catholic Charities said the state had blocked it from seeking relief.

“[T]he actions of the State have prevented the Charities from being able to obtain relief from the Illinois court system,” the group's lawyers wrote.

Anthony Martinez, executive director of the Civil Rights Agenda, lauded the move.

“I am encouraged to hear that Catholic Charities has realized they cannot win this lawsuit,” he said in a statement, adding that the lawsuit was “all about prioritizing religion over what is best for the children in their care.”