LAST YEAR, a last-minute blitz by some conservative and African American lawmakers derailed proposed legislation to legalize same-sex marriage in Maryland.

Some critics rejected a definition of marriage as anything but the union of one man and one woman; others were concerned that religious groups might be forced to perform same-sex marriage ceremonies that violate their religious beliefs. There may be little that can be done to convince the first group that providing marriage equality to same-sex couples is the right and moral thing to do. There are, however, significant protections that should be extended to religious organizations even as the state provides its gay and lesbian residents the same rights as their heterosexual counterparts.

A bill introduced last week by Gov. Martin O’Malley (D) does an admirable job of meeting both of these legitimate needs. While not immune from all civilian proscriptions, religious organizations must be given wide latitude even when their actions could be deemed biased. The Supreme Court recently affirmed the right of religious organizations to be free from secular mandates that unduly interfere with religious freedom.

Mr. O’Malley’s proposal protects religious organizations from legal liability for refusing to perform marriage ceremonies that conflict with religious tenets. The bill also explicitly shields individual religious leaders and extends protections to associations or nonprofits controlled or owned by religious organizations. Under the bill, such organizations could not be forced to provide services or accommodations to same-sex couples.

This exemption rightly has limits, largely because Maryland law already prohibits discrimination for public accommodations. As one lawmaker put it, an individual who runs a bakery open to the public cannot refuse to bake a wedding cake for a same-sex couple simply because that union offends his religious sensibilities. Neither may the devout owner of a bed-and-breakfast refuse to rent a room to a same-sex couple without running afoul of existing nondiscrimination provisions.

The Maryland Catholic Conference got off on the wrong foot last week by criticizing Mr. O’Malley’s efforts as a distraction from more pressing economic needs. What may be a distraction for the conference is a fundamental concern for the state’s gay and lesbian residents. If the conference is dissatisfied with what it calls “ambiguous” religious protections in the bill, it should work with the governor and lawmakers to fashion a solution.

The protection of constitutional and civil rights need not be a zero sum game. The governor’s legislation respects this principle and should serve as the foundation for a civil and productive way forward.