Mohammad Zahir Shah

The return of King Zahir Shah of Afghanistan, who has died aged 92, to his mountain kingdom in April 2002, after 29 years in exile, was in a sense an act of expiation. He was well-intentioned and patriotic, but also indecisive, and it was his failure to make a democratic system work, by refusing to sign legislation authorising political parties and provincial and municipal councils, that had helped to bring about his demise - and that of his country.

So he stood aside to allow Hamid Karzai to step up from being chairman of the transitional administration to interim president, while the king was given the title of "father of the nation". The new constitution of 2004 abolished the monarchy, and Karzai won that year's presidential elections.

Deposed in 1973, after 40 years on the throne, Zahir Shah had watched helplessly as his country fell victim to a Marxist coup, invasion by the Soviet Union, civil war and, finally, the disaster of the Taliban. In the wake of the attacks of September 11 2001, the apparent rout of the Taliban by US forces and its allies and the formation of an interim Afghan government, the king was seen as the only Afghan capable of presiding over his country's return to representative government. He was proud of that last achievement.

Mohammad Zahir Shah was born in Kabul, educated at schools in Afghanistan and France, studied at the military academy and was groomed for office by his father, Nadir Shah, who made him assistant defence minister in 1932, and then acting education minister in 1933. In November that year he was proclaimed king after his father was assassinated in front of him at a student prize-giving in Kabul, as the result of a personal vendetta.

Zahir Shah began his reign at the age of only 19. His uncles, one of whom was prime minister, immediately rallied round and ran the country for the next 20 years, leaving him time to travel around Europe - he spoke several European languages in addition to Pashto and Farsi - and preside over ceremonial occasions.

Perhaps surprisingly, there was no struggle for power, and the tall, handsome young king enjoyed a peaceful start to his reign. In 1934, Afghanistan joined the League of Nations, and was formally recognised by the United States. On the outbreak of the second world war, the king sensibly opted for neutrality, and Afghanistan became the Switzerland of Asia, full of rival allied and axis spies, prospering from its exports of karakul sheepskins and food.

In 1947, with Britain withdrawing from India and the Soviet Union exerting increasing influence north of the border, the centuries' old balance of power changed abruptly. At partition, despite earlier promises, Britain refused to allow Pashtuns in the North-West Frontier to vote in favour either of independence, or of joining Afghanistan. Kabul reacted by promoting the cause of Pashtunistan - the king himself was a Pashtun.

This angered the new Pakistan government, which imposed an embargo on petroleum products. The Soviet Union was quick to fill the gap, and to exploit a new-found influence. Anxious, however, to see America take over the role of Britain, Afghanistan's colonial patron until full independence in 1921, as a counterbalance to the Soviets, the Afghans unsuccessfully asked America for arms and aid.

Disappointed on all fronts, in 1953 the king chose as prime minister a strong man he knew and trusted, his first cousin, Prince Mohammad Daoud. Dynamic and authoritarian, Daoud advocated economic development, modernisation - women no longer had to wear the veil - and a hard line on Pashtunistan.

In 1956, when the Americans turned down a second request for arms, Daoud turned to Moscow. His popularity appeared to hold. When President Eisenhower visited Afghanistan in 1959, the US secret service were alarmed that ordinary Afghans were allowed to mob the royal limousine as king and president toured Kabul.

Relations with Pakistan, however, continued to deteriorate, and Daoud's obsession with Pashtunistan finally undid him. Tired of border raids, President Ayub Khan, the new military ruler of Pakistan, broke off diplomatic relations. Kabul retaliated by closing the border, which was disastrous for trade and the Afghan economy plummeted. In 1963, as unrest mounted, Daoud resigned.

Daoud's departure heralded a new atmosphere of freedom, encouraging the king to move towards a constitutional monarchy. But the reforms were imperilled by the king's characteristic caution. Liberalism soon turned to licence; and student demonstrations to violence and deaths. Against this background, the People's Democratic (communist) party of Afghanistan was born. The 1969 election produced a swing to the right, but corruption, bureaucracy and the Soviet Union's stranglehold were crippling the economy. A three-year drought led to widespread famine, in which at least 100,000 died.

Ironically, the king seemed to have made the right decision at last when, in 1972, he appointed an energetic young technocrat, Moosa Shafiq, prime minister. Then, on July 17 1973, with the king in Italy, on holiday after treatment for an eye injury in Britain, Daoud seized power in what was probably a long-planned coup.

Relations with the Soviet Union, initially good, deteriorated sharply when Daoud walked out of a meeting with President Brezhnev in 1977. The reckoning came a year later, in April 1978, when Daoud was murdered in a bloody communist coup. In December 1979, the Soviet Union invaded, ushering in the long cycle of war and political anarchy that led to the Karzai government and the fleeting hope that the Taliban insurgency could be suppressed.

Zahir Shah remained silent for most of his exile. He spent his time in a villa in Rome, playing golf and chess and tending his garden. But, according to friends, he never despaired of going home one day, though after his return he went abroad several times for medical treatment. His wife, the former Queen Homaira, died in 2002. They had two daughters and five sons.

· Mohammad Zahir Shah, king of Afghanistan, born October 16 1914; died July 23 2007