When I was a child I tried to read Kim by Rudyard Kipling. I was put off by some obscure language, and also by the plot, which takes a while to get going.

Five years ago I came across the book again and was immediately transfixed. I have since read it a further two or three times, and now consider it the greatest British novel of the 20th century.

At the heart of the novel is a friendship between orphaned Kim and an elderly Tibetan lama who is searching for the “river of life”. Bare-footed Kim, whose father was a British soldier, becomes the Chela (a kind of apprentice) to the lama.

They set off along the Grand Trunk Road, which stretches 1,600 miles from Chittagong in modern Bangladesh to Kabul. Soldiers, spies, thieves, horse-dealers, farmers, mystics, mendicants, and matriarchs all travel down this road. It is a metaphor for life and a character in the book.

I am sure that Kim comes directly from Kipling’s subconscious. He spent the first six years of his life in Bombay, and spoke Hindi fluently by the time he was sent to boarding school in England.

Kipling never went near a university (universities are very good at churning out competent but second rate writers) and was much the better for it.

At the age of 17 he returned to India as a reporter on the Civil and Military Gazette in Lahore. After the last edition had been put to bed Kipling would go through long lonely walks through the town. In the book Kipling sends Kim on a “stealthy prowl through the dark gullies and lanes, the crawl up a water pipe, the sights and sounds of the womens world on the flat roofs and the headlong flight from housetop to housetop under cover of the hot dark.”

That was Kipling’s Lahore. In theory a spy story about the Great Game, Kim anticipates magical realism by about 70 years. It reminds me a great deal of Gabriel Garcia Marquez’s 100 Years of Solitude.

Both novels have a colossal ambition, perfectly realised. I am inclined to think that Kipling has not been given his due because politically correct academics and left-wing book reviewers have thought of him as an imperialist. Others treat him as essentially a writer for children. In truth he is a literary genius and unclassifiable.

Even Orwell, who wrote an interesting essay about Kipling, had nothing at all to say about Kim. I don’t think Orwell can ever have read the book. Kipling was a master not just of the novel, but also of the short story. He wrote some of the greatest poetry in the English language.

This is how the book starts: “He sat, in defiance of municipal orders, astride the gun Zam-Zammah on her brick platform opposite the old Ajaib-Ghar – the Wonder House, as the natives call the Lahore museum. Who holds Zam-Zammah, that ‘fire-breathing dragon’, holds the Punjab, for the great green-bronze piece is always first of the conqueror’s loot.”

The Zam-Zammah gun is still outside the museum in Lahore, not far from the railway station, though nowadays you have to cross a dangerous road to get to it. I pay homage to the gun, and to Kipling, every time I visit Lahore, which is as often as possible.