The recent rioting in Afghanistan, over the burning of Qurans, startled western officials and highlighted an alarming phenomenon, the killing of Nato soldiers and advisers by their Afghan collaborators.
Such events risk undermining a successful transition to Afghan self-rule after 2014, a change that will require cooperation between Nato forces and their Afghan counterparts.
Last year Rodric Braithwaite, a former British ambassador to Russia, published a book, Afgantsy, on the Soviet campaign in Afghanistan between 1979 and 1989. The work presents a valuable backdrop to the problems Nato faces, and is especially sobering for dispelling several myths colouring interpretations of that war.
Mr Braithwaite argues that the Soviet Union did not enter Afghanistan unaware. Rather, it got caught, despite its better judgement. Like Nato in 2001, Moscow realised the country was a graveyard for foreigners. Following an uprising in Herat in March 1979 against the communist regime in Kabul, Soviet leaders debated whether to intervene militarily. They rejected doing so, opting to send more weapons and advisers to the Afghan army.
What ultimately moved the Soviet Union to invade Afghanistan was bloody infighting within the ruling People's Democratic Party there. When Hafizullah Amin overthrew and killed Nur Mohammed Taraki, a protégé of Soviet leader Leonid Brezhnev, the Soviets organised a coup in December 1979 to replace Amin with Babrak Karmal. They then sent in their 40th Army, feeling this was necessary to stabilise the situation, and to help facilitate Afghanistan's transformation into a modern society.
For the Soviet Union, as for the United States later, the decision to go in was characterised by contradictory motivations. Both saw action in Afghanistan as a strategic necessity; the Soviets to block US inroads into the country during the Cold War; the Americans to neutralise the Al Qaeda threat by denying it a base of operations.
Both powers had a keen sense of the political and cultural complications of interacting with Afghan society. However, this awareness failed to displace an element of hubris in their endeavours.
Social engineering was a facet of Soviet behaviour, Mr Braithwaite points out. And it was evident in US President Barack Obama's initial Afghan policy, with its nation-building component. That the Americans have now abandoned that ambition, as did the Soviet Union before them, is not so much a testament to their lucidity as a recognition that their early misgivings were sound.
Once Soviet leaders reckoned that they could not win militarily in Afghanistan, they fell back on an alternative strategy: to shift the burden of the conflict onto the Afghans themselves, and to change their military mission to a support and advisory role. This is precisely what Mr Obama intends to do, and it is why the hostility directed against Nato poses such danger to the US withdrawal deadline.
As Mr Braithwaite underlines, Soviet leaders did rather well in leaving behind a defensible regime. They replaced Mr Karmal with the more competent Mohammed Najibullah, who was able to retain power with Soviet help until September 1992, three years after the Soviets went home. His downfall came when the collapse of the Soviet Union ended military and economic aid to Kabul.
Will Mr Obama, or a successor, manage a similar handover? As many observers have noted, the investment in life and capital that foreign governments must expend to maintain military sway in Afghanistan usually surpasses what is gained.
When Moscow determined that the country was a net drain on its resources in its rivalry with the US, and that there was no chance of remodelling Afghan society, it headed for the exit.
Mr Obama can well appreciate today what Mikhail Gorbachev appreciated in 1985: Afghanistan is easier to enter than to leave. When he took office, the Soviet leader had already settled on withdrawal. But like the US in Vietnam, the Soviets sought to pull out with honour. Some officials, notably the foreign minister, Eduard Shevardnadze, pushed to leave behind a force of 10,000 to 15,000 troops. Only in February 1989 did the last regular units go home.
Afghanistan is a hard country, Mr Braithwaite explains, because, like a Rubik's Cube, most combinations of colours fail to bring harmony. As disparate as Afghan society is, and as divided as the Mujahideen were, this never produced long-term benefits for the Soviet war effort. On the contrary. Afghan discord can offer tactical advantages to military occupiers, but makes it infinitely more difficult to impose a cohesive national government and project. That is Nato's biggest test, and it is one the alliance is failing.
One illustration of this is obvious. As in Soviet days, many Afghan urban areas are in the hands of foreign forces and their local allies, but the countryside is friendlier terrain for their enemies. In a rural country where communications are poor, this is a crippling weakness for a central authority. Things may be better for the Nato forces on that front than they were for the Soviet Union, but waging war in Afghanistan can still be like punching holes in water.
Given their openness to new ideas, US officers have surely read Mr Braithwaite's book. The lessons it provides will hardly reassure them.
Afghanistan is a place which takes a great deal of effort to dominate, but which foreigners quickly conclude they do not truly want to dominate. Those contrary dynamics make victory elusive.
Michael Young is opinion editor of the Daily Star newspaper in Beirut