Irek Hamidullin was a foot soldier for the Taliban, captured after a firefight in 2009 in Afghanistan.

He and his fellow soldiers had tried to attack an Afghan Border Police post, but were routed by U.S. helicopter pilots who killed everyone in his group but him. No U.S. or Afghan government soldiers were injured in the battle. Imprisoned at Bagram Air Base until 2014, Hamidullin was then brought to federal court in Richmond, Virginia, and prosecuted. He was convicted of crimes including material support to terrorists and attempted murder of U.S. military personnel and sentenced to life plus 30 years.

Now that the U.S. has inked a peace deal with the Taliban—with the critical assistance of five former Gitmo detainees exchanged in the swap for Bowe Bergdahl—and President Trump has communicated directly with Taliban leaders, it’s time to reconsider whether Hamidullin (who one of us represented in this criminal case) should remain in federal prison. By negotiating a peace deal with the Taliban, the U.S. has recognized that Taliban soldiers should be treated just like any other adversary.

Hamidullin’s conviction has no precedent in our history. We have always recognized, as the price of war, the right of our adversaries to fight back— and insisted that our soldiers receive the same treatment. In 1775, General George Washington complained to his British counterpart that American soldiers should not be put in jails like criminals, and warned that British prisoners would be treated the same way Americans were treated.

Confederate soldiers likewise were immune from ordinary criminal prosecution. In 1891, a Lakota chief was famously acquitted in federal court of murdering an Army officer on the ground that he was simply fighting in a war. And the U.S. treated captured North Vietnamese soldiers as prisoners of war.

This practice was always meant to protect American soldiers captured by our adversaries. It is summed up by Supreme Court Justice Hugo Black’s observation that “it is no crime to be a soldier,” which is why soldiers may be held until the end of a war but then must be released.

There are reasons to treat the Taliban differently, of course. Deposed in 2001, the Taliban are not recognized as the legitimate government of Afghanistan, even though they have maintained control over large parts of the country since they were overthrown. Nor do they observe the laws of war.

But neither did the North Vietnamese. Hamidullin, moreover, was never accused of committing a war crime. And a soldier fighting on behalf of a deposed government is still a soldier. German soldiers, after World War II, were even prosecuted for executing captured French partisans who fought after the Germans took Paris, because the Free French were still entitled to be treated as soldiers.

News reports say that the principal sticking point in the new peace deal is not the ongoing Taliban attacks on Afghan security forces, but the commitment “to expeditiously release combat and political prisoners as a confidence building measure,” in which “up to five thousand prisoners of the [Taliban]” and “up to one thousand prisoners of the other side” are to be released. The plan also provides for the “goal of releasing all of the remaining prisoners over the course of the subsequent three months.”

Afghan President Ashraf Ghani, who is not a party to the deal, reportedly has objected that “freeing Taliban prisoners is not the authority of America, but the authority of the Afghan government.” Although he originally authorized the release of fifteen hundred Taliban soldiers as a prelude to peace talks, that decision is now up in the air.

But there is one prisoner who should be released by the U.S. government right now: Irek Hamidullin. He is no different than any other soldier in any other war we’ve fought. He thus committed no crime by fighting on a battlefield against the United States. Now that the U.S. has entered into a peace deal with the Taliban, he should be released—because that’s how U.S. soldiers should be treated.

Geremy Kamens is the federal public defender for the Eastern District of Virginia, and represented Mr. Hamidullin in his criminal case. Captain Mizer is the lead defense counsel for a defendant facing a military commission at U.S. Naval Station Guantanamo Bay, Cuba.