Alabama could be on the edge of a constitutional crisis because of tensions over same-sex marriage that have pitted the state’s chief justice against the supreme court in a battle over state and federal law.

Last week, a federal judge ruled the state’s ban on same-sex marriage unconstitutional, just as her colleagues across the US have been doing for the past two years. Alabama officials are nonetheless putting up a fight, even though advocates for marriage equality are optimistic that the supreme court will this year rule against all state bans.

“Alabama has so far been more resistant to complying with the judge’s order and opinion than almost any other state,” said Carl Tobias, a law professor at the University of Richmond.

US district court judge Callie Granade struck down Alabama’s ban on Friday of last week. On Tuesday, she ruled against the ban again in a separate case, citing her previous ruling. Both decisions are temporarily on hold, though, so no same-sex marriages have happened in the state.

Granade, who was appointed by President George W Bush, said the ban was unconstitutional, echoing rulings made by judges at state, district and appellate levels in the past two years. Like several states before it, Alabama appealed.

Roy Moore, the chief justice of Alabama’s supreme court, sent a letter to the state’s governor saying the US constitution does not give the federal government the power to regulate Alabama law. He also said state judges should not issue licenses for same-sex marriages, though he did not legally prohibit them from doing so.

This led Granade to clarify in an order on Wednesday that state judges would have to allow same-sex marriages if the stays on her rulings were lifted. The Alabama Probate Judges Association said it would follow her judgement.

“The letter was extremely unusual and is based on very shaky legal grounds at best,” said Sonja West, associate law professor at the University of Georgia, of Moore’s words.

The supremacy clause of the US constitution says federal law takes precedence over state law. The most notable instances of states refusing to abide by such federal directives have primarily concerned racial issues.

Rulings for both Alabama cases are on hold until 9 February, and the state has filed a request for an appeal in the 11th US circuit court. If its appeal is granted, Granade’s ruling will be stayed until the supreme court makes a ruling on same-sex marriage. That is due by the end of June. If the state’s appeal is denied, same-sex marriages will begin in Alabama, which will be the 37th state to legalize them.

The situation in Alabama is almost identical to the one that until recently prevailed in Florida, where same-sex marriage became legal earlier this month. Florida officials fought rulings striking down the state’s ban, including one that applied to a specific county. This led to confusion across the state in county clerk offices, where marriage licenses are issued.

Eventually, the 11th circuit and the supreme court refused to grant stays on a district judge’s ruling against the state’s ban.

“There’s some real tension in the air between the federal judge’s ruling and state compliance,” said Tobias. “We’ll see what happens.”

The plaintiffs in the first Alabama case, Cari Searcy and Kimberly McKeand, married legally in California. They brought the challenge because Searcy is not allowed under Alabama state law to adopt McKeand’s biological son. A state and appeals court ruled against the couple before Granade ruled in their favor.

The plaintiffs in the second case, James Strawser and John Humphrey, are seeking the ability to get a marriage license in Alabama. They have not been married in another state.

The supreme court said earlier this month that it will take up the issue in its current session.