Thomas Macaulay: Indians, he said, are 'a people who have much in common with children'. Photograph: Alamy

The man praised for a legal code that has stood the test of 150 years didn't think much of the subjects for whom it was intended. Indians, said Thomas Babington Macaulay, are "a people who have much in common with children".

One of the giants of Victorian history and law was deeply imbued with a sense of English superiority. He was judgmental and dismissive of most who crossed his path. Sometimes he would avert his gaze from a distance. When he arrived in India the roads were not good enough for a carriage, and he would travel mostly by palanquin carried by two alternating teams of six bearers. Even this treatment did not impress him. "The physical organisation of the Bengalee is feeble even to effeminacy. He lives in a constant vapour bath. His pursuits are sedentary, his limbs delicate, his movements languid."

This engaging biography by the historian Zareer Masani is mercifully devoid of 21st-century judgmentalism. By contemporary mores, Macaulay is a hopeless bigot. But he staked his reputation on creating a more egalitarian legal system for India, which has stood the test of time. Indeed, 150 years later, it is praised for its enlightenment and durability. He introduced a new education system and ensured that English, not Persian, became the lingua franca.

Soon after arriving in India in 1834, working for the governor-general, Macaulay campaigned for equality before the law to all colonial subjects. "No person will be entitled," he explained in a letter to his father, "on the plea of being the master of another, to do anything to that other which it would be an offence to do to a freeman." He also wanted to harmonise laws that varied considerably from province to province. Apparently in Bombay the death penalty applied across a range of offences, from murder to breaking a china cup in someone's home.

The new legal code was ready in 1837, but such was the resistance among the imperial masters that it took more than 20 years for it to be enacted, by which point he was long returned. It took the Great Mutiny in 1857 to concentrate minds.

For the four years that he spent in India, Macaulay had little time for the country or its people. He buried himself in the great works. On his journey out, he consumed "the Iliad and the Odyssey, Virgil, Horace, Caesar's commentaries, Bacon's De Augmentis, Dante, Petrarch, Ariosto, Tasso, Don Quixote, Gibbon's Rome, Mill's India, all 70 volumes of Voltaire, and the seven folios of the Biographia Britannica". He mastered a language a fortnight, but would not stoop to include an Indian tongue in his repertoire.

He had a curiously affectionate relationship with his sister, Hannah. Her misery compounded his. On their departure from England, she wrote: "I have taken leave for years of almost anything I care for on Earth and given up all chance of happiness."

So how to reconcile his contribution to India with his disdain for it? As the subtitle to the book (Britain's Liberal Imperialist) attests, Masani attributes to Macaulay a 19th-century variant of Blairite liberal interventionism. He saw it is as his duty to "modernise" (for that read westernise) Muslim and Hindu society, pushing back the orientalist policy of non-interference in local customs, which was the fashion. He saw no need for cultural exceptionalism, no need to tolerate practices such as bride burning and female infanticide. His world view was demarcated between enlightened nations and barbarians – a veritable clash of civilisations.

On his return to London in 1838, Macaulay spent some years in parliament, first as war minister then as paymaster general. He was respected far more than he was liked. "His plebeian origins, combined with his garrulous ways and unattractive appearance, made him the butt of many… private and public observations," Masani writes. These did not knock him off his stride. He was not shy in proffering his opinions. Thus, when visiting Versailles, he described the palace as a "huge heap of littleness".

He didn't think too highly of the young Queen Victoria. "The separation of her lips," he wrote in his journal, "is certainly almost disagreeable, particularly as seen from below. As to the rest, she is rather a nice girl." The feelings were mutual. She observed to Lord Melbourne, her prime minister, that she thought Macaulay odd-looking, "uncouth, and not a man of the world." The author adds: "The very suave Melbourne is said to have agreed."

As a Whig MP and then member of the Lords, Macaulay dipped in and out of politics. His mantra of modernisation did not extend to universal suffrage. Such indulgence of the working man would bring him "indescribable misery". He had come to this view "not from disregard of their interests, but from the same feeling which would lead me to refuse a razor to a man who told me that he wanted it in order to cut his throat".

His The History of England consumed his later career; it dominates his legacy. The author notes the celebrity it brought Macaulay. American sales of his second volume reached 100,000 within weeks of publication. Six rival translators competed for the rights for the German edition alone. Masani might have devoted more space to analysing this brilliant and tendentious work, one of the staple texts of any understanding of a country he saw as the fulcrum of civilisation.