John Walker Lindh, a U.S. citizen who moved to Afghanistan and joined the Taliban, was released from prison Thursday after serving 17 years of a 20-year sentence.

As expected, his return to society is controversial.

Some reports indicate that he has not changed his radically anti-U.S. views. They quote him making statements in support of the Islamic State, evidence that he remains a terrorist threat. For some people, this reinforces the view that he’s a traitor who should remain in prison for the rest of his life based on the original charges brought against him.

The strong feelings behind these positions are entirely understandable. But let’s put them aside for a moment. Instead, let’s consider just how crucial the notion of law and order is to the health of our democracy and its institutions.

As odious as Lindh’s professed allegiances were, he still received due process. He had the opportunity to hire counsel and took part in judicial proceedings, ultimately receiving a plea bargain. He then went on to serve his sentence in a unit of the Terre Haute Federal Correctional Institution in Indiana.

At a time when the nation is divided on so many fronts, upholding the rule of law must be something that we should all be able to agree upon. Yet since the beginning of our apparently endless war on terrorism, justice has been anything but blind, as we have struggled to find legal norms to deal with people accused of plotting and committing violent crimes against the United States.

At first, 9/11 unified us from coast to coast and all points in between. But that feeling of oneness was momentary. Our debates over how we should respond to the attacks on U.S. soil soon revealed deep differences.

Initially and understandably, the desire was for retribution. One October 2001 poll showed 88% of Americans approving of a military response focused on Afghanistan, where Osama bin Laden was thought to have been in hiding.

About the same time, an international poll showed that people in most other countries preferred a legal rather than military solution: extradition and trials of those suspected of implementing, planning and aiding in the attacks.

In both cases respondents wanted to see justice. Americans, whose compatriots had died in the attacks, predictably preferred the visceral version over the procedural one.

The capture of Lindh, who immediately became known as the American Taliban, changed the equation. We were no longer simply discussing how to punish nameless people on the other side of the world. How would we deal with fellow citizens who joined forces with those eager to do us harm?

We still haven’t come up with an entirely adequate response, although U.S. citizens can reliably count on a trial on U.S. soil, with some representation and some measure of transparency.

U.S. citizenship ensures a much broader set of protections than many foreign-born terrorism suspects received after the attacks. The U.S. government took suspected members of the Taliban, al-Qaida and other terrorist groups into custody, held them for long periods, denied them due process, then tried and convicted them in opaque military trials. This isn’t really up for debate. It’s merely stating the facts.

The inhumane treatment of these suspects, and the denial of their basic rights at the U.S. detention center in Guantanamo Bay, are some of the most serious long-term miscarriages of justice in our country’s history and contributed to the corroding perception of moral authority we once enjoyed.

Even worse, many other countries have mimicked U.S. policy, using often unsubstantiated terrorism- and national security-related charges — Iran and Turkey come immediately to mind — to justify the imprisonment of political opponents and others perceived to be at odds with the state.

We see these tactics to deny due process increasingly employed around the world.

Lindh — mostly because of his American citizenship, and perhaps because of the high-profile nature of his case — did get a trial in U.S. court. He had legal representation and the opportunity to defend himself. His 20-year sentence was reduced by three years for good behavior.

At the time of his capture, he was a troubled and misguided 20-year-old who made a terrible decision to join a conflict abroad that eventually put him at odds with his home country. Whether he is repentant, he has paid a heavy price for that crime.

His plea bargain continues to generate considerable controversy among those who wanted to see him punished more harshly. But if there is a single silver lining to this chapter in one of our country’s longest and most bitter stories, it’s that his release is a victory for the rule of law. Justice was served.