Michael Long, left, and Timothy Long kiss outside the Rowan County Judicial Center in Morehead, Ky., Friday. (AP)

Kentucky county clerk Kim ­Davis’s assertion that she answers to a higher authority won her no reprieve from a federal judge this week. But the question of whether people must obey the law when they say it violates their religious beliefs is being debated in state legislatures and the nation’s courts and has become a galvanizing issue in the Republican presidential nomination campaign.

Legal experts across the political spectrum said Davis was on shaky ground as a public official who has pledged to uphold the law. But the question of whether private citizens and organizations — and officials such as Davis — deserve more protection for their religious beliefs is a contentious one across the country.

Gay couples in Rowan County on Friday received the marriage licenses that Davis had withheld, as deputy clerks handed out the $35 documents. Davis defiantly remained in federal custody after U.S. District Judge David L. Bunning jailed her Thursday for refusing to issue the licenses.

Some Republican presidential candidates rushed to endorse her view that “God’s authority” outweighed her duty to comply with orders from the Kentucky governor and federal judges carrying out the Supreme Court’s decision that gay couples have a constitutional right to marry.

But legal experts tended to agree with Bunning, who told Davis that “the idea of natural law superseding this court’s authority would be a dangerous precedent indeed.”

Jonathan Adler, a law professor at Case Western University who has been closely following the controversy, said, “She asked to be the person who issues marriage licenses. And the state defines who is eligible to marry.” Sometimes, he said, the eligibility changes.

Steven Shapiro, legal director of the American Civil Liberties Union, which helped represent the Rowan County couples, said Bunning’s actions make clear that “public officials may not ignore the law. We have reached this point only because Ms. Davis chose to defy the court’s order and place her own personal views ahead of the Constitution.”

But if Davis’s actions are not constitutionally shielded, legislatures and courts may still play a role in accommodating religious beliefs.

Both North Carolina and Utah have passed protections for those who do not want to issue marriage licenses in their name to gay couples, and more legislatures are considering it.

There are dozens of suits across the country from religiously affiliated organizations that object to the contraceptive mandate contained in the Affordable Care Act and say the Obama administration’s proposed accommodation for them — signing a form that shifts the burden for providing coverage elsewhere — is not enough.

That fight is likely to reach the Supreme Court, even though every appeals court that has considered the issue has ruled in favor of the administration.

A group of objecting judges on the appeals court in Denver this week pointed out the delicate job of the judiciary in deciding what does or does not constitute a religious hardship. “I am aware of no precedent holding that a person’s free exercise was not substantially burdened when a significant penalty was imposed for refusing to do something prohibited by the person’s sincere religious beliefs (however strange, or even silly, the court may consider those beliefs),” Judge Harris Hartz of the U.S. Court of Appeals for the 10th Circuit wrote for himself and four others.

No judge so far has agreed with Davis, who stopped issuing marriage licenses to both heterosexual and homosexual couples. After Bunning and an appeals court panel ruled she must start issuing licenses, she went to the Supreme Court. But the justices did not even ask for a response from the other side before declining to get involved. No justice signaled disagreement with the decision.

The Davis saga has further exposed a fissure among the 17 Republican candidates when it comes to issues of religion and the law — a fault line that emerged after the Supreme Court ruled in June that same-sex couples have the right to marry nationwide.

Some candidates are asserting that Davis must follow the law and issue the licenses or find another job. But the field’s religious conservative flank is vigorously supporting Davis.

Former Arkansas governor Mike Huckabee plans to visit Kentucky on Tuesday for what his campaign is touting on Twitter as an “#I’mWithKimLibertyRally.”

“Having Kim Davis in federal custody removes all doubt of the criminalization of Christianity in our country,” Huckabee said in a statement. “Five, unelected Supreme Court lawyers did not and cannot make law. They can only make rulings. The Supreme Court is not the supreme branch and it’s certainly not the Supreme Being.”

Dan Holler, communications director for the conservative Heritage Action of America, said appeals to religious liberty tap into a “very real sense that people of faith now need to be protected in some way to make sure they cannot be punished for acting in accordance with their faith. That’s something that resonates with conservative primary voters.”

Among Republican presidential candidates, former neurosurgeon Ben Carson has based his tax plan on tithing; Wisconsin Gov. Scott Walker often brings up religious liberty when he’s asked about same-sex marriage; and Sen. Ted Cruz of Texas held a “Rally for Religious Liberty” last month in Des Moines that drew about 2,500 people.

“Those who are persecuting Kim Davis believe that Christians should not serve in public office,” Cruz said in a statement this week. “That is the consequence of their position. Or, if Christians do serve in public office, they must disregard their religious faith — or be sent to jail.”

Sen. Rand Paul, who represents Kentucky, said on CNN that “it’s absurd to put someone in jail for exercising their religious liberty.”

Other candidates are stressing religious liberty but asserting ­Davis must comply with the ruling.

Businesswoman Carly Fiorina, former Ohio governor John Kasich and Sen. Lindsey Graham of South Carolina said after the Supreme Court’s decision in June that they believed in traditional marriage, but they say Davis must follow the court’s ruling.

“She’s accepted a job where she has to apply the law to everyone,” Graham said on the conservative law professor Hugh Hewitt’s radio show.

Former Florida governor Jeb Bush and Sen. Marco Rubio of Florida tried to strike a similar balance.

There ought to be a “big enough space,” Bush said, “for her to act on her conscience, and for now that the law is the law of the land, for a gay couple to be married in whatever jurisdiction that is.”

Such compromises can be difficult to find. Appeals to “natural law,” and morality, as Davis and Bunning discussed Thursday, are difficult for a judge to assess, said Richard Garnett, a Notre Dame law professor who specializes in religion and the law.

Gay couples are sincere in their belief that the fundamental right of marriage should be open to them; religious opponents devoutly feel that it is a sin they should not condone.

It is better to base legal arguments on constitutional protections and statutes such as the Religious Freedom Restoration Act, said Mark Rienzi, a Catholic University law professor who is fighting the contraceptive mandate but is not involved in the Davis case.

Judges may have their own ideas of morality, he said, “but I don’t think any of them have the authority to enforce their own moral preferences.”