Figuratively standing in the courthouse door, Alabama Chief Justice Roy Moore has already drawn comparisons to segregationist governor George Wallace for ordering Alabama judges not to issue same-sex marriage licenses. And indeed, as many Alabama judges began issuing such licenses today, his last-ditch attempts to stop them now seem futile.

But some legal experts say that Justice Moore may have the law on his side.

From the perspective of history, the Moore/Wallace comparison is apt. In both cases, a conservative Alabaman, popularly elected, has defied a federal court order – Wallace in 1963 on desegregation, Moore in 2015 on same-sex marriage. In both cases, the specter of the Confederacy haunts the debate over “states’ rights” and federalism. And in both cases, one has the sense of a conservative “rebel” standing on the wrong side of history.

This is, after all, the same Roy Moore who went to the legal mat to defend “Roy’s Rock,” a gigantic stone carving of the Ten Commandments—and won.

From the perspective of the legal details, though, the two cases are different. Governor Wallace rested only on constitutional ideals, and a view of federalism that was settled by the Civil War. Justice Moore’s order relied on the niceties of administrative law.

Technically speaking, the Alabama cases, Searcy vs. Strange (adoption) and Strawser v. Strange (marriage), resulted in injunctions against Alabama’s executive branch of government, represented by the attorney general, not to enforce Alabama’s same-sex marriage amendment. They did not extend to probate judges, who were not parties to the case and are employees not of the executive, but of the judicial branch.

And the head of the judicial branch? Chief Justice Roy Moore.

In two memos, one on February 3 and the second on February 8, Moore wrote that probate judges aren’t bound by the injunctions. In the first memo, he said that probate judges aren’t required to defer to the district court’s reasoning—essentially leaving it up to them to decide. In the second, he changed his mind, and ordered probate judges to disobey it “to ensure the orderly administration of justice.”

“Roy Moore got it right,” wrote Florida law professor Howard Wasserman on the Prawfsblawg legal blog last week. “And without bigoted or anti-federal rhetoric.” Probate judges are not covered by the injunction, and Moore is within his rights as head of the judicial branch.

Wasserman told The Daily Beast that “this is more than technical. Judge Granade made a mistake—or allowed the plaintiffs to make a mistake—in forming their case. The result is an injunction against the person (the attorney general) who lacks any power to do anything with respect to licenses and no injunction against the people (probate judges) who do.”

Wasserman added that “any individual probate judge can (and should) be the named defendant if/when he refuses to grant the license.”

Ironically, this can now be done: Now that licenses have been issued, and not issued, in Alabama, a non-issuing probate judge can easily be added to the case and call the marriage off.

Wasserman dismisses the claims that such judges could be jailed for contempt of court. “This would be utterly impossible,” he said. A federal court “cannot hold in contempt anyone who was not party to the federal action, which is only the attorney general.”

Rather, the non-obeying judges can be added to the case as it progresses—precisely because they can now be clearly identified.

Now it’s clear that Moore didn’t need to pull out all the legal stops here. He could easily have taken a broader, common-sense approach to the district court injunction, and brought Alabama in line with all the other states that have reluctantly complied with federal court orders on same-sex marriage.

Clearly, Chief Justice Moore is simply doing anything he can to stop gay marriage—which is good politics too, since his is an elected office and most Alabamans oppose it.

And Moore probably knows that he will lose. He’s lost today, with many judges issuing marriage licenses to jubilant same-sex couples—although many others are not doing so—and his view seems unlikely to prevail at the Supreme Court later this year. This makes his “stand in the courthouse door” an easy piece of political theatre.

It has also created what the New York Times has aptly called “judicial chaos,” with individual probate court judges torn between the demands of their boss and those of a federal court. Moore has created a self-fulfilling prophecy: by warning of judicial chaos and taking action to ostensibly avoid it, he has, instead, created it.

This is probably the point. Opponents of same-sex marriage have long had an image problem. On one side, couples crying tears of joy on the courthouse steps. On the other side—what, exactly? With “judicial chaos,” there is at least a competing narrative.

Even if it does look suspiciously like the ghosts of Alabama’s past.