Editor's note: Aaron David Miller is a vice president and distinguished scholar at the Woodrow Wilson International Center for Scholars and was a Middle East negotiator in Democratic and Republican administrations. Follow him on Twitter. The opinions expressed in this commentary are solely those of the author.
(CNN) -- Having worked in government for more than two decades on the foreign policy side, one of my key takeaways is that the world is a cruel and unforgiving place. And with apologies to Clint Eastwood, more often than not, United States policy options are choices not among the good, bad and the ugly, but just between the last two.
The deal to bring Bowe Bergdahl home was one such tortuous choice. Let's be clear: This is a very bad, even ugly deal. The United States undercut almost every principle we claim to adhere to on negotiating with terrorists (in this case, the Haqqani network, the militant group that was holding Bergdahl, has plenty of American blood on its hands) and let out some very bad guys who are almost certain to direct any number of enterprises to attack Americans and weaken the U.S. efforts in Afghanistan.
And the administration carried out the Bergdahl deal with its characteristic lack of tactical dexterity and smarts, failing to brief key members of Congress appropriately and perhaps even violating U.S. law. Finally, for all its effort, given the strange and confusing facts surrounding Bergdahl's own actions, the Obama administration is being severely criticized for what it has done.
But notwithstanding all that, and however distasteful the deal, it was both a moral and necessary one. And here's why:
Written or unwritten, traditional code or assumed values, in an America-initiated war there are American responsibilities and commitments to those who fight it. We didn't seek out the Afghan campaign. It was a legitimate response to the 9/11 attacks, regardless of how badly managed and unattainable its objectives became over the past decade.
And it matters not a whit that we have a volunteer military and that Bergdahl willfully stepped up or that he may have turned against the war or perhaps even deserted his post. These are matters that may or may not be sorted out later.
What counts are the responsibilities and obligations the U.S. military and political establishment -- in this case, the commander in chief -- have to those whom they put in harm's way. This relationship between the state and those it marshals and mobilizes to defend the country -- draft or volunteer military -- is a fundamental and contractual obligation.
That tradition was established in our own Civil War, in which the magnitude of the death and human misery fundamentally changed the relationship between the federal government and its citizenry.
As the extraordinary PBS documentary "Death and the American Civil War" makes clear, before 1861, "there were no national cemeteries in America. No provisions for identifying the dead, or for notifying next of kin, or for providing aid to the suffering families of dead veterans. No federal relief organizations, no effective ambulance corps, no adequate federal hospitals, no federal provisions for burying the dead. No Arlington Cemetery. No Memorial Day."
That war created a new frame of reference for soldier, citizen, and the state: a new set of commitments and undertakings at the national level that have broadened and deepened to this day. That Bergdahl may have violated his part of the contract is dismaying, even perverse, under the circumstances. But it is really not the point.
He's one of ours in a war we may not have sought but that our military fought; we made his presence on the field of battle possible and we are responsible for getting him back.
Does that mean paying any price and sacrificing countless Americans lives in the process? Of course not. But it does mean undertaking a determined -- even relentless -- effort to look for opportunities and ways to accomplish it consistent with our interests and values.
Now for the price that was paid. The details of the urgency, timing and opportunity to trade for Bergdahl are not at all clear. The state of his health, the accuracy of Qatari warnings that his life was in danger, growing frustration on the part of his captors are all missing pieces. And we may never know them fully. The end results are clear though.
Did the Haqqani network score a propaganda victory in this trade? Yes, they did. Did the United States weaken its own hand by showing that it will trade kidnapped U.S. soldiers for Afghan prisoners? Sure it did. Is there a risk that those we released will conspire again to kill Americans? You bet there is. But these are contingencies, possibilities in a world of uncertainties that must be measured against the certainty and reality of recovering an American life and redeeming a soldier after five years of captivity.
We will never know whether, had the United States not cut this deal, Bergdahl would have been irreparably damaged or killed. Under these circumstances, the decision to redeem Bergdahl was not only compelling, it was a moral imperative.
We are not the Israelis. We do not live in an environment of threat and insecurity, one in which our citizens serve in the military and that service is inextricably linked to our culture, values and perception of the world. We do not face existential threats. Nor is our political establishment conditioned to accept asymmetrical trades with terrorists that can reach such proportions as the prisoner deal with Hamas for kidnapped Israeli soldier Gilead Shalit, who was traded for 1,027 Palestinian prisoners. But we claim to be a moral nation with values and principles that coexist alongside our interests.
Indeed, many argue that our values are our interests. I cannot think of many foreign policy actions in recent years in which the United States acted principally for moral, ethical or humanitarian considerations. This is one of those rare occasions.
And instead of beating ourselves up -- and the President, too -- for acting according to values that we purport to cherish, we need to face up to the fact that we had the conviction and courage to act in a way that was both moral and necessary, however messy the process and the price we may yet pay.