OKLAHOMA CITY (AP) — Legislation that protects members of the clergy who refuse to perform a same-sex marriage ceremony has been approved by the Oklahoma House and Senate.

The House voted 87-8 for the bill Wednesday while a nearly identical bill passed the Senate on a 38-5 vote. All opposing votes came from Democrats.

The bills protect clergy members and others authorized to perform weddings from being required to perform them if it conflicts with their religious beliefs. They also shield churches from being required to participate in the ceremonies.

Troy Stevenson of Freedom Oklahoma, which advocates for the rights of gay and transgender Oklahomans, says he believes the bills are unnecessary but that he supports the spirit of the laws.