ALBANY — It was just a few paragraphs, but they proved to be the most microscopically examined and debated — and the most pivotal — in the battle over same-sex marriage.

Language that Republican senators inserted into the bill legalizing same-sex marriage provided more expansive protections for religious organizations and helped pull the legislation over the finish line Friday night.

The Republicans who insisted on the provision did not only want religious organizations and affiliated groups to be protected from lawsuits if they refused to provide their buildings or services for same-sex marriage ceremonies, they also wanted them to be spared any penalties by state government. That would mean, for example, a church that declined to accommodate same-sex weddings could not be penalized later with the loss of state aid for the social service programs it administers.