Days of God: The Revolution in Iran and its Consequences. By James Buchan. John Murray; 482 pages; £25. To be published in America in autumn 2013 by Simon & Schuster. Buy from Amazon.com

THE world has had more than three decades to get used to it, yet some might still be tempted to judge Iran’s Islamic revolution an historical aberration. The most celebrated account of the events of 1978-79, by a Polish journalist, Ryszard Kapuscinski, explored in poetic cadences the flaws of the monarch himself, Shah Muhammad-Reza Pahlavi, and his browbeaten, but ultimately wrathful, subjects. In “Days of God”, a British scholar, James Buchan, trains a more scientific eye on how Iran’s wealth-creator king was replaced with a Shia divine uninterested in modern government. He mines the literature in Persian and English to better effect than any historian so far. If Kapuscinski enabled his readers to feel the convulsions of 1979, Mr Buchan lays out how it all came to pass.

No revolution is without its gestation, even if hidden. Iran’s Shia clergy had been politically assertive since the 19th century, tolerating impiety in the monarch provided he resist foreign colonialism and local heresies. Between the wars, Reza Shah, Muhammad-Reza’s father, tried to boot religion out of public life as he modernised his country on a shoestring. Under his son, income from oil started to create a Western-style consumerist society. Revenues soared eightfold between 1972 and 1973, when oil prices rose dramatically. Iran spent its way out of medieval turpitude and was hailed as the new Japan. Meanwhile, an ayatollah named Ruhollah Khomeini fumed in exile.

The shah pursued a “Great Civilisation”—a blend of personal rule, manufactured ceremonial and what one Western journalist called a “hyper-boom”. The monarch epitomised the mood of excess, womanising energetically and ordering nuclear reactors, a high-speed rail network and two Concorde supersonic jets.

Iran sank a third of its oil revenues into military procurement—from America, its chief partner, and also from Britain. The shah was a hardware geek. “What is the sprocket horsepower of the Chieftain tank?” he asked the British ambassador. And yet, in the villages visited by Mr Buchan, then reading Persian at Oxford, the people lived in houses made of mud.

In the 1960s and 1970s hubris, corruption and foreign mass culture smashed through the delicate filigree of Persian society. The villages emptied; shantytowns arose on the edge of once-traditional cities now teeming with raucous Westerners. As Mr Buchan puts it, “it was as if [the shah’s] haste to force modernity on Iran was matched by a haste to demolish it, and the conflicts of centuries were being squeezed into half a dozen years.” But even then, he argues, as the boom ended and the shah’s jails filled with leftists and religious radicals, most Iranians shied from revolution.

How that changed, and how Khomeini went from being a marginalised priest to slayer of the monarchy, occupies the central section of “Days of God”, a familiar story of canny opposition, royal dithering and gathering panic on the part of the shah’s Western backers. The richness of this telling lies in the details. Dogs were run through a provincial town with placards marked “Towards the Great Civilisation” pinned to their rumps. An earthquake was brilliantly exploited by the revolutionaries; their relief effort was more effective than that of the government. Mr Buchan’s account of an infamous arson attack on a cinema, in which at least 470 people were killed, and which was blamed on the authorities (unfairly, as he demonstrates) is unrivalled.

For all his faults, the shah was no butcher. After a year of protests, he fled his people rather than mow them down. (The revolution was marked by relative restraint on both sides; thousands died, not tens of thousands.) He was replaced by a man who for millions represented the traditional Iran that they had been instructed to shun. But Khomeini, iron-willed and indifferent to worldly phenomena, also spoke to the Shia longing for a messiah. For the last decade of his life, following his triumphant return home in February 1979, he ran Iran according to what he regarded as sacred values.

From his support for the takeover of the American embassy in 1980, which destroyed Iran’s relationship with the United States, to his prosecution of the bloody, eight-year war with Iraq, Khomeini confounded his enemies by subordinating conventional earthly gains to less tangible rewards. Here are the domestic “consequences” of Mr Buchan’s subtitle—these and an Islamic republic that still glares at the West, even though many of those early values have become tawdry and debased.

For the rest of the world, as he writes, a spot of local bother turned out to be “one of those events in which history changes direction.” As a modern expression of political Islam in conflict with the West, the revolution was an inspiration to Islamists everywhere—and a warning to those secular totalitarians whose hourglass finally emptied in 2011. Why did the shah’s subjects not accept his notion of history racing to a conclusion in prosperity’s glow? In this fine, elegantly written book, Mr Buchan lays out the answer in detail.