WASHINGTON — The Supreme Court on Thursday unanimously ruled that Philadelphia may not bar a Catholic agency that refused to work with same-sex couples from screening potential foster parents.

Chief Justice John Roberts, writing for six members of the court, said that since the city allowed exceptions to its policies for some other agencies it must also do so in this instance. The Catholic agency, he wrote, “seeks only an accommodation that will allow it to continue serving the children of Philadelphia in a manner consistent with its religious beliefs; it does not seek to impose those beliefs on anyone else.”

The decision, in the latest clash between anti-discrimination principles and claims of conscience, was a setback for gay rights and further evidence that religious groups almost always prevail in the current court.

Philadelphia stopped placements with the agency, Catholic Social Services, after a 2018 article in The Philadelphia Inquirer described its policy against placing children with same-sex couples. The agency and several foster parents sued the city, saying the decision violated their First Amendment rights to religious freedom and free speech.

Lawyers for the city said the case, Fulton v. City of Philadelphia, No. 19-123, was an easy one. When the government hires independent contractors like the Catholic agency, they said, it acts on its own behalf and can include provisions barring discrimination in its contracts.

Lawyers for the agency responded that it merely wanted to continue work that it had been doing for centuries, adding that no gay couple had ever applied to it. If one had, they said, the couple would have been referred to another agency.

Advertising

A unanimous three-judge panel of the U.S. Court of Appeals for the 3rd Circuit, in Philadelphia, ruled against the agency. The city was entitled to require compliance with its nondiscrimination policies, the court said.

The case was broadly similar to that of a Colorado baker who refused to create a wedding cake for a same-sex couple.

In 2018, the Supreme Court refused to decide the central issue in that case, Masterpiece Cakeshop v. Colorado Civil Rights Commission: whether businesses may claim exemptions from anti-discrimination laws on religious grounds. It ruled instead that the baker had been mistreated by members of the state’s civil rights commission who had expressed hostility toward religion.

The foster care agency relied on the Colorado decision, arguing that it too had been subjected to hostility based on anti-religious prejudice. The city responded that the agency was not entitled to rewrite government contracts to eliminate anti-discrimination clauses.

Last year, Justice Clarence Thomas, joined by Justice Samuel Alito, appeared to urge the court to reconsider the 2015 decision that established a constitutional right to same-sex marriage, Obergefell v. Hodges, saying it stigmatized people of faith who objected to those unions.

In his majority opinion in the Obergefell decision, Justice Anthony Kennedy, who retired in 2018, called for “an open and searching debate” on same-sex marriage, writing that “the First Amendment ensures that religious organizations and persons are given proper protection as they seek to teach the principles that are so fulfilling and so central to their lives and faiths, and to their own deep aspirations to continue the family structure they have long revered.”This article originally appeared in The New York Times.