The U.S. Supreme Court has just ruled against Philadelphia, and in favor of Catholic Social Services (CSS), in a case asking whether the agency can discriminate against same-sex couples by refusing to certify them as foster parents. Chief Justice John Roberts, in a judicial sleight of hand, crafted a narrow opinion that can’t be readily exported to other cases. As both a law professor and a gay father with firsthand experience dealing with the city’s foster-care system, I have a complicated reaction to this decision. In the end, though, businesses and agencies that offer services to the public must do so with an even hand. Religious beliefs can’t be a free pass for discrimination.

In 1990, the court held that laws that burden religion do not violate the Constitution, as long as they are neutral and apply generally. The Philadelphia Fair Practices Ordinance would seem to pass that test. It forbids discrimination on a number of grounds — including sexual orientation — by businesses that are open to the public. But the court declined to apply that precedent. It found that the law was not “generally applicable,” since it left the commissioner of the Department of Human Services discretion to waive the requirement that placement of a child be made without regard to sexual orientation. Then the court decided that foster-care agencies are not places of “public accommodation,” and not even controlled by the anti-discrimination law in the first place.

» READ MORE: Supreme Court decision is a win for religious freedom | Opinion

But the law applies to any provider whose services are “available to the public.” Roberts avoided this conclusion by emphasizing that the “certification” of foster parents requires a highly selective and “customized” process, and is nothing like the services we typically associate with public accommodations, such as “staying at a hotel, eating at a restaurant, or riding a bus.” Yet, any adult city resident can apply to become a foster parent, so the services these agencies provide are available to the public.

In distinguishing the services that foster placement agencies provide from other public services, the Supreme Court is not totally off the mark. As I can attest from personal experience, the process of becoming a parent is highly intense, personal, lengthy, and emotionally challenging. It’s vital for the prospective foster or adoptive parents to have a strong and trusting relationship with those working for the agency they’re assigned to. My husband and I would not have wanted to work with CSS under any circumstances. It’s hardly surprising that, according to the record in this case, “no same-sex couple [had] even sought certification from CSS.” And “if it did, CSS would direct the couple to one of the more than 20 other agencies … all of which currently certify same-sex couples.”

Should this reassignment move be permitted? This isn’t like the earlier Supreme Court case involving a cake shop baker who refused to design a “masterpiece” for a gay couple. Even if the couple could just walk down the street to a more accommodating bakery, the refusenik shouldn’t get a pass: If you’re open to the public, you need to bake cakes for all comers. But the relationship between a foster-care agency and prospective parents is nothing like that. So it’s no wonder that gay and lesbian couples have avoided CSS, and the court’s ruling likely won’t make any practical difference.

Regardless, the decision is still wrong and the Supreme Court misread the law. It would be unthinkable for an agency to turn away an interracial couple based on even a sincere belief that such unions violated the agency’s religious beliefs. It wouldn’t matter if every other agency would be happy to certify that couple. Philadelphia’s law aims to protect classes of people historically discriminated against, and sexual orientation is now enumerated as a group fitting that description.

Perhaps the court’s workaround led to a workable, practical solution here. But when the issue is squarely presented, the only defensible outcome is to apply the anti-discrimination law with an even hand.

John Culhane is a professor of law and the H. Albert Young professor of law at Delaware Law School. He lives in Philadelphia with his family. jgculhane@widener.edu