The top of the Ashoka pillar at Sarnath in India. Photograph: The Art Archive/Alamy

It is difficult to imagine a life as full of grandeur and drama as that of the Mauryan emperor Ashoka, but it is more difficult still to imagine how such a life could ever have been lost or forgotten. From 270BC to 233BC, Ashoka ruled every part of the subcontinent except for India's southernmost tip, an empire larger than that of any Indian ruler before or since; his influence spilled even further abroad, into Sri Lanka and past the furthest border of present-day Afghanistan. He shepherded the rise of one of the world's major religions, and in a remarkable U-turn, he transformed himself from a callous conqueror into an intelligent and pacific ruler. Yet, as Charles Allen's Ashoka shows, the details of his life had to be prised out from the crevices of the past, in a process that revealed as much about the emperor as about the caprices of Indian history.

The rediscovery of Ashoka began with the rediscovery of India's Buddhist past. In the late 18th century, scholars were working at synchronising India's calendar of history with Europe's; the philologist William Jones called the resolution of this chronological gulf "the grand desideratum of oriental literature". Around the same time, Buddhist figurines and inscriptions began to be unearthed across India's northern plains. These archaeological finds presented something of a puzzle: they pointed to the vigorous heyday of a religion that was, in the India of the 18th and 19th centuries, in near-terminal decline. Buddhism had left behind no majestic temples, and "there were certainly no Buddhists in India and no Buddhist literature", Allen points out. Under whose patronage, then, did the faith once flourish as mightily as its artifacts seemed to indicate?

Allen is adept, if on occasion ploddingly so, at putting back together this vast academic jigsaw for our benefit. He recounts what Jones would have learned from Greek narratives of Alexander's attempted conquest of India and from subsequent ambassadorial communiqués from the Maurya dynasty's court. He traces the painstaking decryption of the Brahmi script, dating to the third century BC, by James Prinsep, an energetic assay master in the Calcutta Mint. He describes the assiduous legwork of members of the Asiatic Society, which yielded metal-plate inscriptions, sculptures of heartbreaking beauty, remnants of the humped Buddhist reliquaries known as stupas, and elaborate edicts inscribed, on Ashoka's orders, on slabs of rock across the subcontinent. And as Prinsep and his colleagues did, Allen reconciles these threads of evidence with strands from other texts – in particular from the Mahavamsa, Sri Lanka's great Buddhist chronicle – and thus arrives at the story of Ashoka as we know it.

None of this is new material, especially for Allen, who along with John Keay has worn something of a groove in scholarship about the Raj-era resuscitation of Indian history. Anton Führer, the deceitful archaeologist in Allen's The Buddha and Dr Führer (2008), flickers in and out of Ashoka's pages, trafficking in forged Buddhist relics and lying about his discovery of Kapilavastu, the city where the Buddha grew up. More significantly, Ashoka reprises the choicest parts of The Buddha and the Sahibs, Allen's 2002 book about men such as Jones and Prinsep – orientalists in the original, sweet vein of being intellectually curious about Asia, rather than in the pejorative Saidian sense. Allen emphasises that the study of ancient India would have suffered without scholars of the sort derided by Edward Said as "dead white men in periwigs" – a point that is both valuable and arguable, but also a point that he has made before.

An abundance of clues about Ashoka began to emerge from the work of these Indologists. The Mahavamsa spoke in glowing terms of an Indian king who had ordained his own son and daughter and sent them to Sri Lanka to spread the Buddha's message. Stone reliefs dug up from the sites of Buddhist stupas depicted an unusually unidealised king, "short, paunchy and with a grossly pumpkin-like face," as Allen writes. (The Ashokavadana, an ancient text in Sanskrit, called Ashoka's skin "rough and unpleasant to the touch".) Most intriguing were the rock edicts, scattered across an enormous area, all proclaiming a ruler's commitment to non-violence, to righteousness, and to a sophisticated notion of secularism.

By the final years of the 19th century, the contours of Ashoka's life had been established: his adroit power-grab that denied his elder brother the throne; his rampaging invasion of the eastern province of Kalinga, in which his army slew more than 100,000 men; his abrupt but long-lasting conversion to Buddhism; and his support of his new faith, so munificent that he is said to have built 84,000 stupas and donated millions of pieces of gold to the monastic order. But the physical legacy of this zenith of Buddhism was destroyed twice over: first by Hindu Brahmins, who were furious at Ashoka's sponsorship of Buddhism, and who would in subsequent centuries cannily co-opt the Buddha as one of the 10 avatars of Vishnu; and then by Islamist invaders, who razed stupas as well as the illustrious Buddhist university of Nalanda, in present-day Bihar.

Allen might usefully have devoted more space to this calculated domination of Buddhism by Hinduism, which so effectively wiped out traces of Ashoka's reign, and which contradicts descriptions of Hinduism as tolerant and ever-benign. (In 1905, during a lecture in Johannesburg, Mahatma Gandhi stoutly denied any decline of Buddhism in India, claiming: "No Hindu bore the Buddhist any ill will.") Allen is perhaps also too cursory in examining the effect of the rediscovery of Ashoka on the India of the late 19th century, although he briefly mentions the emperor's influence on a particular group of Indians: the new freedom-fighters.

To a burgeoning independence movement, Ashoka proved to be a touchstone on several levels. Gandhi praised Ashoka's non-violence and his latter-day lack of imperial ambition. Jawaharlal Nehru admired Ashoka's secularism and his efficient administration. For nationalists of all stripes, Ashoka was, along with the Mughal emperor Akbar, the soundest rebuttal to the colonial assertion that India's diverse territories had never been united as thoroughly as they were under the British. Ashoka inspired hope that, if India had once been whole and serene under the wisdom of a native ruler, it might well be similarly whole and serene again.

Samanth Subramanian's Following Fish: Travels Around the Indian Coast, will be published by Atlantic later this year.