The Guantánamo story may finally be coming to an end, and as the 20th anniversary of the 9/11 attacks approaches, the question is who will write the last chapter, the White House or the Supreme Court?

President Joe Biden has vowed to close the island detention center, through which nearly 800 detainees have passed since it opened in early 2002 to house some of the "worst of the worst," in the words of the Pentagon at the time. Many of the detainees turned out to be junior jihadists, if that; bounty hunters in Afghanistan had turned over to the eager Americans pretty much anyone they could find, including a hapless group of 17 Uyghurs who were fleeing the Chinese and meant the United States no harm. The inmate count is now down to 40.

President Barack Obama also wanted to close Guantánamo but couldn't manage to do it. Circumstances are different now: Not only is the "forever war" in Afghanistan about to end, but politicians won't find it easy to scare voters with images of the older, wobbly detainees who now make up much of the Guantánamo population. Still, Biden is likely to need cooperation from Congress to transfer any of the facility's detainees to the U.S. mainland.

Biden may get lucky. But in the meantime, a case is on a path to the Supreme Court that will give the justices a chance to redeem the court's own failed Guantánamo promises.

Two weeks ago, in a little-noticed two-page order, the federal appeals court in Washington announced that it would rehear, as a full court, a case brought by a Guantánamo detainee, a Yemeni tribal sheikh named Abdulsalam Ali Abdulrahman al-Hela. The order vacated a decision by a three-judge panel of the court last August that had not only rejected al-Hela's petition for habeas corpus on the facts of his particular case, but went on to declare in sweeping and conclusory terms that the constitutional guarantee of due process simply doesn't apply to Guantánamo detainees. The full court will hear the case on Sept. 30.

The order received almost no attention in the mainstream press. But within the community of lawyers and civil libertarians who still care about Guantánamo, the appeals court's announcement was a galvanizing event because there is every reason to suppose that the reargued case will come out differently. Simple math suggests as much. Of the nine judges who voted on whether to rehear the panel decision (the actual vote was not disclosed) six were appointed by Democratic presidents.

One of the court's newest judges, Gregory Katsas, is recused, presumably because he worked on Guantánamo matters while serving as deputy White House counsel in the Trump administration. The two other Trump-appointed judges are Neomi Rao, who wrote the panel opinion, and Justin Walker, who was not yet on the court when the case was first heard. The appeals court's longest serving judge still in active service is Karen LeCraft Henderson, appointed by President George H.W. Bush in 1990. The court has one vacancy, created by Merrick Garland's departure to become attorney general. Biden's nominee to replace him, Ketanji Brown Jackson, will presumably be confirmed and sitting on the court by September.

With Congress having channeled all the Guantánamo cases to the federal courts in the District of Columbia, there are too many data points over too many years to ignore the rigid partisan divide that has marked the handling of these cases. One Republican-appointed judge who tried to bridge the gap, Thomas Griffith, was a member of the al-Hela panel. He wrote a separate opinion that was sharply critical of the breadth of Rao's opinion. While agreeing that al-Hela was not entitled to habeas corpus, Griffith went on to say:

"The majority reads our precedent as foreclosing any argument that substantive due process extends to Guantánamo Bay. But we have never made such a far-reaching statement about the clause's extraterritorial application. If we had, we would not have repeatedly assumed without deciding that detainees could bring substantive due process claims."

He added: "And if the majority feels that it must break new ground, it should at least do so forthrightly, acknowledging that it is taking a significant step that our court has thus far declined to take." Griffith retired from the appeals court the following week.

One name missing from the appeals court's lineup for the rehearing is that of Judge Raymond Randolph. For years, Randolph has been the appeals court's, if not the country's, leading critic of the Supreme Court's Guantánamo decisions, especially the 2008 decision in Boumediene v. Bush that gave the detainees a constitutional right of access to a federal court, enabling them to seek release by means of petitions for habeas corpus. In a speech to the Heritage Foundation in 2010, Randolph compared the five justices in the Boumediene majority to the characters in "The Great Gatsby," Tom and Daisy Buchanan, "careless people who smashed things up" and "let other people clean up the mess they made."

Randolph, who seemed to beat the law of averages on the number of randomly assigned panels he ended up on in Guantánamo cases, assigned himself the clean up role. In a series of decisions, he did his best to make sure that even though the detainees could petition for habeas corpus, they would never actually get it. He sat on the al-Hela panel, and Rao's opinion echoed his own concurring opinion in a similar case just three months earlier.

The case in which Randolph forcefully presented his argument against due process on Guantánamo, now titled Ali v. Biden, has already reached the Supreme Court in an appeal filed by the detainee, Abdul Razak Ali, in January. The justices are scheduled to consider whether to grant the petition later this month, but last week, Ali's lawyers asked the justices to defer acting on the petition until the appeals court decides the al-Hela case. Clearly, the lawyers' calculation is that a favorable opinion by the full U.S. Court of Appeals for the District of Columbia Circuit would put the issue in a better light.

In the 13 years since deciding the Boumediene case, during which the appeals court has whittled the landmark opinion down to a nub, the Supreme Court has been silent, turning down many cases without explanation or apparent dissent. It's a safe bet that there are not five justices on the court today who would have joined the Boumediene majority. The only member of that majority still serving is Justice Stephen Breyer. Three of the four dissenters, all but Justice Antonin Scalia, who died in 2016 (Chief Justice John Roberts and Justices Clarence Thomas and Samuel Alito), are still there.

So there may be five or six justices today who think that Randolph has been right all along and who would join an opinion saying that whatever unspecified right the court meant to recognize on behalf of the detainees in 2008, it did not include a right to due process. If so, the Supreme Court won't write Guantánamo's last chapter after all. Over to you, President Biden.

Linda Greenhouse, the winner of the 1998 Pulitzer Prize, writes about the U.S. Supreme Court and the law. She reported on the court from 1978 to 2008 for the New York Times, where this article first appeared.