Missouri Sen. Bob Onder, right, and Senate Majority Leader Mike Kehoe address reporters at the state capitol after the filibuster. (David A. Lieb/AP)

For 39 hours, seven Democrats in the Missouri Senate kept up a filibuster aimed at drawing attention to, and ultimately killing, a religious freedom bill that critics called anti-gay.

On Wednesday morning, they were finally cut short. The chamber’s Republican majority voted to end the filibuster and voted in favor of the bill, which if enacted would permit religious organizations and certain others to refrain from activities viewed as condoning or participating in same-sex marriage.

It is the latest and perhaps most dramatic example of the extraordinary opposition being stoked by religious liberties bills, which have proliferated in the wake of the U.S. Supreme Court’s decision last year legalizing same-sex marriage nationally. Social conservatives say the bills are necessary to protect faith-based organizations and faith-driven businesses from being forced to condone a practice that clashes with their religion.

But such measures have been met with fierce opposition by gay rights supporters and others, including prominent businesses that warn it could harm commerce by painting the state as bigoted. They point to the example of Indiana, which took a hit to its reputation last year after the legislature passed its own religious protection law.

Backlash against Indiana's religious freedom law grew this week, with opponents arguing it legalizes discrimination against gays and lesbians. Late-night hosts David Letterman, Conan O'Brien and Seth Meyers joined the fray with a few jabs of their own. (Gillian Brockell/The Washington Post)

So far, that lesson appears to be reverberating nationally as several states have recently rejected bills painted as anti-gay or anti-transgender. Last week, South Dakota’s Republican governor vetoed a bill that would have required schoolchildren to use the bathroom that matched with their biological sex, which critics said was discriminatory against transgender students.

Also last week, the West Virginia legislature voted down a religious liberties bill after a backlash from employers including Marriott and AT&T. And in Georgia, a religious freedom bill faced dismal prospects after the state’s Republican governor suggested he would not support it in its original form.

The Missouri bill, which has yet to be voted on in the House, would put a measure on the November ballot that would amend the state Constitution to prohibit the state from penalizing religious organizations and others for their faith-based opposition to same-sex marriage. It appeared to be sailing through the Senate this week when the chamber’s small number of Democrats decided late Monday to mount a filibuster.

For nearly 40 hours, they spoke on a range of topics in hopes of delaying and derailing the bill, wandering from such subjects as George Washington to local authors to the Democratic presidential candidates. They spoke about how they believed future generations would frown on this bill if voters support amending the state constitution.

“By putting this in the constitution, we are tying their hands and we are saying to them we know better than they do about what kind of society they want to live in,” state Sen. Jason Holsman (D) said around hour 18 of the filibuster. “I don’t think that’s the case.”

The filibuster garnered attention, including from local employers such as Monsanto, which opposed the bill. “We call on other businesses and the [agriculture] community to join us in speaking out against discrimination in Missouri and around the world,” the company tweeted.

On the other side, Sen. Ted Cruz (R-Tex.), a Republican contender for president who has made protecting religious liberties a centerpiece of his campaign, tweeted a warning. “Missouri: Remember in November the Democrats who filibustered over 30 hours to fight against religious liberty.”

2016 Republican presidential candidate Sen. Ted Cruz (R-Tex.) told a crowd in Iowa that he commends Indiana "for doing the right thing" in regard to the Religious Freedom Restoration Act. (Reuters)

Gay rights groups condemned the bill’s passage but praised the senators who held up the filibuster. “Discrimination against LGBT people should never be sanctioned by the state, and we call on the Missouri House of Representatives to resoundingly reject this outrageous resolution,” Sarah Warbelow, legal director for the gay-rights group Human Rights Campaign, said in a statement.

This story has been updated to correct the party affiliation of the Georgia governor, and to remove a reference to the filibuster setting a record. It is unclear how the filibuster compares in length to others in the state.