Visiting India in 1921, E. M. Forster witnessed the eight-day celebration of Lord Krishna’s birthday. This first encounter with devotional ecstasy left the Bloomsbury aesthete baffled. “There is no dignity, no taste, no form,” he complained in a letter home. Recoiling from Hindu India, Forster was relieved to enter the relatively rational world of Islam. Describing the muezzin’s call at the Taj Mahal, he wrote, “I knew at all events where I stood and what I heard; it was a land that was not merely atmosphere but had definite outlines and horizons.”

Forster, who later used his appalled fascination with India’s polytheistic muddle to superb effect in his novel “A Passage to India,” was only one in a long line of Britons who felt their notions of order and morality challenged by Indian religious and cultural practices. The British Army captain who discovered the erotic temples of Khajuraho in the early 19th century was outraged by how “extremely indecent and offensive” depictions of fornicating couples profaned a “place of worship.” Lord Macaulay thundered against the worship, still widespread in India today, of the Shiva lingam. Even Karl Marx inveighed against how man, “the sovereign of nature,” had degraded himself in India by worshipping Hanuman, the monkey god.

Repelled by such pagan blasphemies, the first British scholars of India went so far as to invent what we now call “Hinduism,” complete with a mainstream classical tradition consisting entirely of Sanskrit philosophical texts like the Bhagavad-Gita and the Upanishads. In fact, most Indians in the 18th century knew no Sanskrit, the language exclusive to Brahmins. For centuries, they remained unaware of the hymns of the four Vedas or the idealist monism of the Upanishads that the German Romantics, American Transcendentalists and other early Indophiles solemnly supposed to be the very essence of Indian civilization. (Smoking chillums and chanting “Om,” the Beats were closer to the mark.)

As Wendy Doniger, a scholar of Indian religions at the University of Chicago, explains in her staggeringly comprehensive book, the British Indologists who sought to tame India’s chaotic polytheisms had a “Protestant bias in favor of scripture.” In “privileging” Sanskrit over local languages, she writes, they created what has proved to be an enduring impression of a “unified Hinduism.” And they found keen collaborators among upper-caste Indian scholars and translators. This British-Brahmin version of Hinduism — one of the many invented traditions born around the world in the 18th and 19th centuries — has continued to find many takers among semi-Westernized Hindus suffering from an inferiority complex vis-à-vis the apparently more successful and organized religions of Christianity, Judaism and Islam.