Thanks to the Supreme Court’s recent decision in Obergefell v. Hodges, federal and state legislators can no longer impose marriage limitations based on sexual orientation. Libertarians support that legal structure. But we also argue that private businesses have a constitutional right to boycott same-sex weddings. Can those two positions be harmonized?

Yes. The Constitution is not a code of conduct to which citizens must submit. It has two primary objectives: to secure personal liberty and limit the power of government. The chains of the Constitution bind government, not individual actions.

That’s why it’s consistent for libertarians to advocate both the right to gay marriage and the right to discriminate against same-sex couples. Government may not discriminate in granting marriage licenses. But private parties should be able to consort with whomever they please. The rights at stake are those related to association, property, privacy, and religious exercise. Individuals and business owners should be able to serve, or not serve, anyone they please — guided by the marketplace and constrained by competition. Customers who object can take their business elsewhere. Usually, although not always, that process leads to fair outcomes.

Admittedly, prior to the Civil Rights Act, free markets might have produced segregated public accommodations. It’s hard to be certain. Markets were impeded by Jim Crow, corrupt law enforcement, biased judges, extralegal violence, and even denial of services such as water and electricity to firms that wouldn’t toe the segregationist line. Moreover, free markets are not perfect. But neither is government. The proper comparison is not markets versus an ideal world where social justice is ubiquitous.

Rather, the relevant comparison is markets versus government regulation. No reasonable person disputes that government occasionally does good things. But the equation isn’t complete without considering the bad that inevitably accompanies the good. Along with restaurant and hotel integration — which would have happened without government, although more slowly — we now have the inequities associated with such practices as minority setasides and racial preferences in school admissions, not to mention expanded schemes that might require Jewish bakers to provide cakes at Nazi weddings, and black florists to supply flowers at a Klan funeral.

From a legal perspective, discrimination should be permitted in any society that honors freedom of association. A member of one religious or racial or ethnic group should not be required, against his or her will, to associate with members of other groups. On the other hand, it’s perfectly consistent to argue from an ethical perspective that religious, racial, and ethnic discrimination is sometimes reprehensible. We should condemn people who practice such discrimination, even as we insist on their legal right to do so. Private discrimination that isn’t engineered by government can be censured via nongovernmental means — for example, refusal to patronize bigots, social ostracism, and adverse publicity regarding the discriminatory acts. We can denounce immoral conduct — such as lying, infidelity, and even bigotry — without empowering the state to take remedial action.

That’s especially appropriate in the case of same-sex weddings. Forcing private parties to serve gay weddings is a higher order of coercion than forcing private hotels and restaurants to provide rooms and food to black — or gay — travelers. Bakers, florists, photographers, caterers, and so on — when directed to serve a gay wedding — must perform an expressive act that implies support for the institution of same-sex marriage. That goes beyond acceptance of gay people. By contrast, hotel owners were asked only to provide rooms to black travelers, not participate in a ceremony of religious, philosophical, or expressive meaning.

More generally, markets and competition offer builtin incentives against discrimination. Consider the obvious examples of professional football and basketball: NFL and NBA teams consist disproportionately of African American players — not because team owners are benevolent integrationists, but because the players are talented and attract large and profitable audiences. If owners were to discriminate by not hiring black players, they would pay a price for their bigotry. Competitive markets tend to penalize bigots. Government intervention, by contrast, tends to strain the social fabric by compelling unwelcome relationships.

In short, we should condone private — but not government — discrimination, even if the rationale is that a service provider simply doesn’t want to deal with the persons seeking service. That rationale — however offensive it may be in some circumstances — is implicit in our right not to associate, which is the flip side of our constitutional right of association, guaranteed by the First Amendment.