What strikes you first is the human predicament. Sergeant Bowe Bergdahl was detained for five years, the last US citizen to be held captive by the Afghan Taliban. His parents had still not seen him when they appeared before the cameras in the sort of flags-and-family scene American television and politics love. His father – with his huge bushy beard and ponytail, hardly a photofit of your standard US serviceman's dad – suggested that his son might have to learn to speak English again and would need time to "decompress"; "if he comes up too fast, it could kill him".

Difficult though Bergdahl's reintegration into the western world will doubtless be, though, the politics threaten to be many times more complicated. Sparks of controversy flew as soon as his liberation was announced – for the return of this American prodigal son (some reports suggest he deserted) was the product of a deal; a prisoner exchange, no less, which may make it unprecedented in recent American diplomacy. And to say that it was not universally welcomed is to put it mildly.

It is not that the US has refused to deal with dubious characters and groups in the recent past. It may have done, but deniability was always enshrined in the terms. Here we have a deal, sanctioned by President Obama, under which one US soldier has been officially released in exchange for the five most senior Taliban prisoners at Guantánamo Bay.

This goes far beyond talking to the Taliban – itself hugely controversial in the US throughout the war in Afghanistan. For senior Republicans, including Senator John McCain – but not just for them – this amounts to treating with terrorists, even betraying the sacred memory of those killed on 9/11. It is something the United States did not, and would not, do.

Republicans also suspect that Obama – not an adroit congressional operator hitherto – of pulling a fast one by not giving Congress due notice.

The more farsighted may also discern the writing on the wall for Guantánamo itself. If five of its most "high value" occupants can be released with only the administration's say-so, Obama may yet be able to honour his recently repeated promise to close the place he regards as "unconstitutional" before he leaves office. There will simply be no one worth keeping there any longer.

In this way, the exchange may be seen as a sign – one of the most convincing yet – of the pragmatism that underlies the president's much-criticised foreign policy. It is about as far from the trigger-happy dogmatism of George Bush as it is possible to be; proof positive that the whole concept of the "war on terror" is no more. At the same time, it should be observed that this is something that probably only a second-term president could even contemplate, however pragmatic he wanted to be.

Obama might also cite in his support the periodic (and often numerically one-sided) exchanges negotiated between Israel and the Palestinians, which say so much about the value Israelis place on the lives of their own.

None of these arguments, however, features in the justifications that have poured forth from the White House, the Pentagon and the state department.

They have played down ideology, insisting that Bergdahl's release should be seen as a prisoner exchange of the sort that routinely takes place after a war. As such, you could argue, it amounts to a statement that the war in Afghanistan is now over – not just for the US but also for the Taliban. It also implies, though, that the Taliban is now seen by the US administration as just another warring party, which to many Americans – and, indeed, many Afghans – it is not.

This is one reason why the exchange has caught flak not just from US Republicans and others at home but from Afghan leaders, for whom talking to the Taliban remains contentious.

Not unnaturally they also resent the appearance, if not the fact, that this exchange was negotiated over their heads. As they see it, this is no way to treat a friendly sovereign country. That the five Taliban prisoners are to spend a year in Qatar en route, rather than being repatriated at once, irks the Afghan government still more.

The obvious rejoinder is that otherwise the exchange might not have happened, and the single American prisoner of the Taliban would have remained a nagging reminder – for all concerned – of unfinished American business in Afghanistan. With Osama bin Laden dead and western intervention drawing to a close, this is one less tie that binds.