Many modern apologists for British colonial rule in India no longer contest the basic facts of imperial exploitation and plunder, rapacity and loot, which are too deeply documented to be challengeable. Instead they offer a counter-argument: granted, the British took what they could for 200 years, but didn’t they also leave behind a great deal of lasting benefit? In particular, political unity and democracy, the rule of law, railways, English education, even tea and cricket?

Indeed, the British like to point out that the very idea of “India” as one entity (now three, but one during the British Raj), instead of multiple warring principalities and statelets, is the incontestable contribution of British imperial rule.

Unfortunately for this argument, throughout the history of the subcontinent, there has existed an impulsion for unity. The idea of India is as old as the Vedas, the earliest Hindu scriptures, which describe “Bharatvarsha” as the land between the Himalayas and the seas. If this “sacred geography” is essentially a Hindu idea, Maulana Azad has written of how Indian Muslims, whether Pathans from the north-west or Tamils from the south, were all seen by Arabs as “Hindis”, hailing from a recognisable civilisational space. Numerous Indian rulers had sought to unite the territory, with the Mauryas (three centuries before Christ) and the Mughals coming the closest by ruling almost 90% of the subcontinent. Had the British not completed the job, there is little doubt that some Indian ruler, emulating his forerunners, would have done so.

Divide and rule ... an English dignitary rides in an Indian procession, c1754. Photograph: Universal History Archive/Getty Images

Far from crediting Britain for India’s unity and enduring parliamentary democracy, the facts point clearly to policies that undermined it – the dismantling of existing political institutions, the fomenting of communal division and systematic political discrimination with a view to maintaining British domination.

In the years after 1757, the British astutely fomented cleavages among the Indian princes, and steadily consolidated their dominion through a policy of divide and rule. Later, in 1857, the sight of Hindu and Muslim soldiers rebelling together, willing to pledge joint allegiance to the enfeebled Mughal monarch, alarmed the British, who concluded that pitting the two groups against one another was the most effective way to ensure the unchallenged continuance of empire. As early as 1859, the then British governor of Bombay, Lord Elphinstone, advised London that “Divide et impera was the old Roman maxim, and it should be ours”.

Since the British came from a hierarchical society with an entrenched class system, they instinctively looked for a similar one in India. The effort to understand ethnic, religious, sectarian and caste differences among Britain’s subjects inevitably became an exercise in defining, dividing and perpetuating these differences. Thus colonial administrators regularly wrote reports and conducted censuses that classified Indians in ever-more bewilderingly narrow terms, based on their language, religion, sect, caste, sub-caste, ethnicity and skin colour. Not only were ideas of community reified, but also entire new communities were created by people who had not consciously thought of themselves as particularly different from others around them.

Large-scale conflicts between Hindus and Muslims (religiously defined), only began under colonial rule; many other kinds of social strife were labelled as religious due to the colonists’ orientalist assumption that religion was the fundamental division in Indian society.

Muslim refugees cram aboard a train during the partition conflict in 1947 ... the railways were first conceived by the East India Company for its own benefit. Photograph: AP

It is questionable whether a totalising Hindu or Muslim identity existed in any meaningful sense in India before the 19th century. Yet the creation and perpetuation of Hindu–Muslim antagonism was the most significant accomplishment of British imperial policy: the project of divide et impera would reach its culmination in the collapse of British authority in 1947. Partition left behind a million dead, 13 million displaced, billions of rupees of property destroyed, and the flames of communal hatred blazing hotly across the ravaged land. No greater indictment of the failures of British rule in India can be found than the tragic manner of its ending.

Nor did Britain work to promote democratic institutions under imperial rule, as it liked to pretend. Instead of building self-government from the village level up, the East India Company destroyed what existed. The British ran government, tax collection, and administered what passed for justice. Indians were excluded from all of these functions. When the crown eventually took charge of the country, it devolved smidgens of government authority, from the top, to unelected provincial and central “legislative” councils whose members represented a tiny educated elite, had no accountability to the masses, passed no meaningful legislation, exercised no real power and satisfied themselves they had been consulted by the government even if they took no actual decisions.

As late as 1920, under the Montagu-Chelmsford “reforms”, Indian representatives on the councils – elected by a franchise so restricted and selective that only one in 250 Indians had the right to vote – would exercise control over subjects the British did not care about, like education and health, while real power, including taxation, law and order and the authority to nullify any vote by the Indian legislators, would rest with the British governor of the provinces.

Democracy, in other words, had to be prised from the reluctant grasp of the British by Indian nationalists. It is a bit rich to oppress, torture, imprison, enslave, deport and proscribe a people for 200 years, and then take credit for the fact that they are democratic at the end of it.

A corollary of the argument that Britain gave India political unity and democracy is that it established the rule of law in the country. This was, in many ways, central to the British self-conception of imperial purpose; Kipling, that flatulent voice of Victorian imperialism, would wax eloquent on the noble duty to bring law to those without it. But British law had to be imposed upon an older and more complex civilisation with its own legal culture, and the British used coercion and cruelty to get their way. And in the colonial era, the rule of law was not exactly impartial.

Crimes committed by whites against Indians attracted minimal punishment; an Englishmen who shot dead his Indian servant got six months’ jail time and a modest fine (then about 100 rupees), while an Indian convicted of attempted rape against an Englishwoman was sentenced to 20 years of rigorous imprisonment. In the entire two centuries of British rule, only three cases can be found of Englishmen executed for murdering Indians, while the murders of thousands more at British hands went unpunished.

The death of an Indian at British hands was always an accident, and that of a Briton because of an Indian’s actions always a capital crime. When a British master kicked an Indian servant in the stomach – a not uncommon form of conduct in those days – the Indian’s resultant death from a ruptured spleen would be blamed on his having an enlarged spleen as a result of malaria. Punch wrote an entire ode to The Stout British Boot as the favoured instrument of keeping the natives in order.

Political dissidence was legally repressed through various acts, including a sedition law far more rigorous than its British equivalent. The penal code contained 49 articles on crimes relating to dissent against the state (and only 11 on crimes involving death).

Rudyard Kipling, ‘that flatulent voice of Victorian imperialism would wax eloquent on the noble duty to bring law to those without it’. Photograph: Culture Club/Getty Images

Of course the British did give India the English language, the benefits of which persist to this day. Or did they? The English language was not a deliberate gift to India, but again an instrument of colonialism, imparted to Indians only to facilitate the tasks of the English. In his notorious 1835 Minute on Education, Lord Macaulay articulated the classic reason for teaching English, but only to a small minority of Indians: “We must do our best to form a class who may be interpreters between us and the millions whom we govern; a class of persons, Indians in blood and colour, but English in taste, in opinions, in morals and in intellect.”

The language was taught to a few to serve as intermediaries between the rulers and the ruled. The British had no desire to educate the Indian masses, nor were they willing to budget for such an expense. That Indians seized the English language and turned it into an instrument for our own liberation – using it to express nationalist sentiments against the British – was to their credit, not by British design.

The construction of the Indian Railways is often pointed to by apologists for empire as one of the ways in which British colonialism benefited the subcontinent, ignoring the obvious fact that many countries also built railways without having to go to the trouble and expense of being colonised to do so. But the facts are even more damning.

The railways were first conceived of by the East India Company, like everything else in that firm’s calculations, for its own benefit. Governor General Lord Hardinge argued in 1843 that the railways would be beneficial “to the commerce, government and military control of the country”. In their very conception and construction, the Indian railways were a colonial scam. British shareholders made absurd amounts of money by investing in the railways, where the government guaranteed returns double those of government stocks, paid entirely from Indian, and not British, taxes. It was a splendid racket for Britons, at the expense of the Indian taxpayer.

The railways were intended principally to transport extracted resources – coal, iron ore, cotton and so on – to ports for the British to ship home to use in their factories. The movement of people was incidental, except when it served colonial interests; and the third-class compartments, with their wooden benches and total absence of amenities, into which Indians were herded, attracted horrified comment even at the time.

Asserting British rule during the war of independence, also known as the Indian mutiny, 1857. Photograph: Universal History Archive/Getty Images

And, of course, racism reigned; though whites-only compartments were soon done away with on grounds of economic viability, Indians found the available affordable space grossly inadequate for their numbers. (A marvellous post-independence cartoon captured the situation perfectly: it showed an overcrowded train, with people hanging off it, clinging to the windows, squatting perilously on the roof, and spilling out of their third-class compartments, while two Britons in sola topis sit in an empty first-class compartment saying to each other, “My dear chap, there’s nobody on this train!”)

Nor were Indians employed in the railways. The prevailing view was that the railways would have to be staffed almost exclusively by Europeans to “protect investments”. This was especially true of signalmen, and those who operated and repaired the steam trains, but the policy was extended to the absurd level that even in the early 20th century all the key employees, from directors of the Railway Board to ticket-collectors, were white men – whose salaries and benefits were also paid at European, not Indian, levels and largely repatriated back to England.

Racism combined with British economic interests to undermine efficiency. The railway workshops in Jamalpur in Bengal and Ajmer in Rajputana were established in 1862 to maintain the trains, but their Indian mechanics became so adept that in 1878 they started designing and building their own locomotives. Their success increasingly alarmed the British, since the Indian locomotives were just as good, and a great deal cheaper, than the British-made ones. In 1912, therefore, the British passed an act of parliament explicitly making it impossible for Indian workshops to design and manufacture locomotives. Between 1854 and 1947, India imported around 14,400 locomotives from England, and another 3,000 from Canada, the US and Germany, but made none in India after 1912. After independence, 35 years later, the old technical knowledge was so completely lost to India that the Indian Railways had to go cap-in-hand to the British to guide them on setting up a locomotive factory in India again. There was, however, a fitting postscript to this saga. The principal technology consultants for Britain’s railways, the London-based Rendel, today rely extensively on Indian technical expertise, provided to them by Rites, a subsidiary of the Indian Railways.

Mother and children ... the British left a society with 16% literacy, a life expectancy of 27 and over 90% living below the poverty line. Photograph: Bettmann/Bettmann Archive

The process of colonial rule in India meant economic exploitation and ruin to millions, the destruction of thriving industries, the systematic denial of opportunities to compete, the elimination of indigenous institutions of governance, the transformation of lifestyles and patterns of living that had flourished since time immemorial, and the obliteration of the most precious possessions of the colonised, their identities and their self-respect. In 1600, when the East India Company was established, Britain was producing just 1.8% of the world’s GDP, while India was generating some 23% (27% by 1700). By 1940, after nearly two centuries of the Raj, Britain accounted for nearly 10% of world GDP, while India had been reduced to a poor “third-world” country, destitute and starving, a global poster child of poverty and famine. The British left a society with 16% literacy, a life expectancy of 27, practically no domestic industry and over 90% living below what today we would call the poverty line.

The India the British entered was a wealthy, thriving and commercialising society: that was why the East India Company was interested in it in the first place. Far from being backward or underdeveloped, pre-colonial India exported high quality manufactured goods much sought after by Britain’s fashionable society. The British elite wore Indian linen and silks, decorated their homes with Indian chintz and decorative textiles, and craved Indian spices and seasonings. In the 17th and 18th centuries, British shopkeepers tried to pass off shoddy English-made textiles as Indian in order to charge higher prices for them.

The story of India, at different phases of its several-thousand-year-old civilisational history, is replete with great educational institutions, magnificent cities ahead of any conurbations of their time anywhere in the world, pioneering inventions, world-class manufacturing and industry, and abundant prosperity – in short, all the markers of successful modernity today – and there is no earthly reason why this could not again have been the case, if its resources had not been drained away by the British.

If there were positive byproducts for Indians from the institutions the British established and ran in India in their own interests, they were never intended to benefit Indians. Today Indians cannot live without the railways; the Indian authorities have reversed British policies and they are used principally to transport people, with freight bearing ever higher charges in order to subsidise the passengers (exactly the opposite of British practice).

This is why Britain’s historical amnesia about the rapacity of its rule in India is so deplorable. Recent years have seen the rise of what the scholar Paul Gilroy called “postcolonial melancholia”, the yearning for the glories of Empire, with a 2014 YouGov poll finding 59% of respondents thought the British empire was “something to be proud of”, and only 19% were “ashamed” of its misdeeds.

All this is not intended to have any bearing on today’s Indo-British relationship. That is now between two sovereign and equal nations, not between an imperial overlord and oppressed subjects; indeed, British prime minister Theresa May recently visited India to seek investment in her post-Brexit economy. As I’ve often argued, you don’t need to seek revenge upon history. History is its own revenge.

• Inglorious Empire by Shashi Tharoor is published by Hurst & Company at £20. Go to bookshop.theguardian.com or call 0330 333 6846. Free UK p&p over £10, online orders only. Phone orders min p&p of £1.99