WASHINGTON — The Supreme Court said Monday it will take up a dispute between the city of Philadelphia and a Catholic charity over the suitability of same-sex parents to provide foster care. The issue is when enforcement of laws against discrimination goes too far, violating religious freedom.

The case could lead the court to reconsider its 30-year-old decision that said citing religious beliefs does not provide an exemption from general laws that apply to everyone. That decision has long been a target of conservatives, who believe it restricts religious freedom. But civil liberties groups say overturning it would blunt efforts to fight discrimination.

The court agreed to hear an appeal brought by Catholic Social Services, one of 30 agencies that contract with Philadelphia to find homes for abused and neglected children. After learning in 2018 that the group would not consider same-sex couples as potential parents for foster children, the city ended its contract with the charity for that service.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

In its lawsuit, Catholic Social Services said endorsing same-sex couples as foster parents would violate its religious teachings about marriage, so it sued. But lower federal courts said they city was acting properly to enforce its non-discrimination laws. The Third Circuit Court of Appeals, based in Philadelphia, ruled that "religious belief will not excuse compliance with general civil rights laws."

The Catholic charity "failed to make a persuasive showing that the city targeted it for its religious beliefs, or is motivated by ill will against its religion, rather than sincere opposition to discrimination on the basis of sexual orientation," the court said.

In asking the Supreme Court to take the case, the charity's lawyers said no same-sex couple has ever approached Catholic Social Services to ask about becoming a foster parent. The appeals court ruling "allows governments to exclude religious foster-and-adoption agencies unless they speak the government's preferred message regarding marriage."

But the city, urging the Supreme Court not to hear the appeal, said it did not target Catholic Social Services over religious beliefs. Instead, it acted to oppose discrimination and to ensure "that all qualified Philadelphians have access to governmental services provided by contractors and paid for by their taxes."

The Supreme Court ruled in 1990 that religious groups are not exempt from general local, state, and federal laws. The decision came in the case of two Native Americans who worked at an Oregon drug rehab center and were fired for ingesting peyote — an illegal drug — at a church service. They had claimed an exemption from the state's drug law, arguing that their use of peyote was part of a tribal religious ritual.

A decision overturning that ruling would make it easier for businesses to claim a religious exemption from state and local laws that ban discrimination on the basis of sexual orientation. Ever since the Supreme Court struck down laws against gay marriage in 2015, lawsuits have popped up around the country brought by bakers, florists, photographers and others who say their religious beliefs will not allow them to provide services for same-sex weddings.

The court will hear the case during its next term, which begins in October.