There's a glaring political divide in the 4th Circuit Court of Appeals decision to stop President Trump's revised executive order limiting entry into the U.S. for some people from a few terror-plagued Muslim-majority nations. The court ruled against the president by a solid 10 to 3 vote. All ten on the winning side were appointed by Presidents Barack Obama or Bill Clinton. All three on the losing side were appointed by Presidents George W. Bush or George H.W. Bush.

If anything, the decision shows the value of a two-term presidency in shaping the courts. The 4th Circuit, once solidly conservative, is conservative no longer with six Obama appointees.

Chief Judge Roger Gregory's majority decision is 79 pages long, but it boils down a single point: It doesn't matter whether the text of the Trump order is constitutional, because the president's previous statements about Muslims, made mostly during the campaign, prove that it is based in animus against a religion, and is therefore unconstitutional.

Gregory made his case in a headline-grabbing opening paragraph, in which he declared that the executive order "in text speaks with vague words of national security, but in context drips with religious intolerance, animus, and discrimination."

The majority's decision, as laid out by Gregory, suggests a mind-bending possibility: If the Trump executive order, every single word of it, were issued by another president who had not made such statements on the campaign trail, the court would find it constitutional.

"There is no doubt that this is a Trump-only decision," said John Yoo, the Berkeley law professor who served in the George W. Bush Justice Department, in an email exchange Thursday. "The Fourth Circuit clearly says that the executive order is legal on its face because of its invocation of national security reasons. But the court refuses to apply the traditional deference to the president and Congress in immigration affairs because of Trump's statements both as a candidate and as president that -- it claims -- reveal he is acting in bad faith."

At the heart of the issue is an argument over whether, in a matter like the Trump order, judges can look behind the plain text of the document to discern the author's motives. The debate in the Trump matter rests on two cases dating from the early 1970s: Lemon v. Kurtzman and Kleindienst v. Mandel. At its core, the new 4th Circuit decision is a group of Democratic-appointed judges saying "Lemon shows we are right," and a group of Republican-appointed judges saying "Mandel shows we are right."

This is no place for in-depth legal analysis -- especially since I am not a lawyer -- but the short version is, Lemon was a 1971 case involving a state law in Pennsylvania which allowed some public money to go to private, that is, religious, schools. The Supreme Court struck down the law and established what some have called the Lemon test. For a law like Pennsylvania's to pass constitutional muster, the decision said, the government must show three things: 1) that the law has a "secular legislative purpose"; 2) that the "principal or primary effect" of the law "must not advance nor inhibit religion"; and 3) that the law "must not result in an 'excessive government entanglement' with religion."

In his decision, Gregory said the Trump executive order was all about the first test, the "purpose" test. "Under the Lemon test's first prong, the government must show that the challenged action 'has a secular legislative purpose,'" Gregory wrote. "Accordingly the government must show that the challenged action has a secular purpose that is 'genuine, not a sham, and not merely secondary to a religious objective.'"

Gregory then argued that Trump's campaign statements prove that the Trump executive action, whatever its stated concerns about national security, is in fact rooted in hatred for Muslims. At one point, Gregory seemed to concede that the order on its face might well be constitutional, and that is why he, Gregory, had to look beyond the text. "If we limited our purpose inquiry to review of the operation of a facially neutral order, we would be caught in an analytical loop, where the order would always survive scrutiny," Gregory wrote. "It is for this precise reason that when we attempt to discern purpose, we look to more than just the challenged action itself." By looking at Trump's statements, Gregory said, "it is evident" that the executive order "is likely motivated primarily by religion." That doesn't mean that the order has no national security purpose at all, just that "any such purpose is secondary to [the order's] religious purpose."

So Gregory, and the rest of the court's Democratic appointees, ruled against the president.

The reliance on the Lemon "purpose" test struck some experts as dead wrong. "Lemon shows again why this is a Trump-only case," wrote John Yoo. "The Supreme Court has all but overruled Lemon. It never follows the Lemon test anymore, because of its inherent unpredictability and vagueness. That the 4th Circuit turned to it here showed how far it would go to extend judicial power to stop Trump."

On the other side, the dissenters -- the three Republican-appointed judges -- cited Kleindienst v. Mandel, a 1972 case that has the virtue of actually involving immigration. In that case, the attorney general denied entry into the U.S. of Ernest Mandel, a self-described "revolutionary Marxist" writer from Belgium. The university professors who invited Mandel claimed that the attorney general's decision deprived them of their First Amendment right to hear Mandel speak. The Supreme Court sided with the government, holding that 1) Congress had "plenary power to exclude aliens or prescribe the conditions for their entry into this country"; and 2) in the law Congress had delegated that power to the executive branch; and 3) when the attorney general decides "for a legitimate and bona fide reason" not to admit someone, "courts will not look behind his decision."

That was the core of the three dissenters' argument. Judge Paul Niemeyer, the George H.W. Bush appointee, wrote that the majority was wrong to refuse to apply the Mandel precedent, and had thereby "fabricat[ed] a new proposition of law -- indeed, a new rule -- that provides for the consideration of campaign statements to recast a later-issued executive order." The result, Niemeyer wrote was a decision "radically extending" Supreme Court precedents in religion cases.

Niemeyer and the two other dissenters, said Yoo, "urge the traditional deference that the courts have paid to the elected branches on national security and immigration matters." As for the majority:

The court's approach here is unprecedented. Federal judges have never before questioned the motive behind a president's order, which was otherwise valid on its face. Trump, on the other hand, has given courts the material -- also for first time -- to question the good faith of a presidential order. But the decision could hamstring future presidents. Courts could be forever in the business of testing the "real" purposes of presidential actions for invalid motives. No matter how they decide, such review could sap chief executives of the speed and decisiveness that are necessary to deal with national security threats.

Almost immediately after the 4th Circuit ruling was announced Thursday, Attorney General Jeff Sessions said the Justice Department "strongly disagrees" with the decision and will seek review in the Supreme Court.

Because the president's case is strong, and because the case broke down on partisan lines in the 4th Circuit, some observers feel confident Trump will prevail with a Supreme Court that has five Republican appointees and four Democratic appointees. But that confidence might be misplaced. First, it is true that the four Democrats on the Court are slam-dunk certain to vote against the president. Some Republicans are certain to vote for him. But the Court's perennial swing vote, Justice Anthony Kennedy, will be under enormous pressure from the usual quarters -- the New York Times, National Public Radio, etc. -- to show his essential goodness as a human being by voting against Donald Trump. And what about Neil Gorsuch? The justice that Gorsuch replaced, Antonin Scalia, would have blown the Fourth Circuit decision clear out of the water. But Gorsuch is a question mark.

The dispute over the Trump executive order is being fought in the courts, but it is intensely political. The shortest short version of the case is: It's all about Trump. Given that, even if the law is clear, there's no telling what the Supreme Court will do.