When Britain granted India independence, 75 years ago, the territory it had ruled over was divided, or partitioned, into India and the new state of Pakistan (with East Pakistan later becoming Bangladesh).
This created an upsurge of violence, in which approximately 15 million people were displaced and an estimated one million died.
India and Pakistan have remained rivals ever since.
Why was British India partitioned?
In 1946, Britain announced it would grant India independence.
No longer able to afford to administer the country, it wanted to leave as quickly as possible.
The last viceroy, Lord Mountbatten, set the date as 15 August 1947.
The population was about 25% Muslim, with the rest mostly Hindu but also Sikh, Buddhist and other religions.
"The British used religion as a way of dividing people in India into categories," Prof Navtej Purewal, Indian fellow for the Arts and Humanities Research Council, says.
"For example, they created separate Muslim and Hindu lists of voters for local elections.
"There were seats reserved for Muslim politicians and seats reserved for Hindus.
"Religion became a factor in politics."
Dr Gareth Price, at the UK-based Chatham House foreign-policy institute, says: "When it looked likely that India would get independence, many Muslim Indians became worried about living in a country ruled by a Hindu majority.
"They thought they would be overwhelmed.
"They started to support political leaders who campaigned for a separate Muslim homeland."
Congress Party independence-movement leaders Mohandas Gandhi and Jawaharlal Nehru wanted a united India that embraced all faiths.
But All-India Muslim League leader Muhammad Ali Jinnah demanded partition as part of the independence settlement.
"It would have taken a long time to get agreement about how a united India would work," Dr Price says.
"Partition seemed to be a quick and simple solution."
How much suffering was caused by partition?
British civil servant Sir Cyril Radcliffe drew up the borders between India and Pakistan, in 1947, dividing the sub-continent very roughly into:
a central and southern part, where Hindus formed the majority
two parts in the north-west and north-east that were mostly Muslim
But Hindu and Muslim communities were scattered throughout British India.
About 15 million people travelled, often hundreds of miles, to cross the new frontiers.
And many were driven out of their homes by communal violence, starting with the 1946 Calcutta Killings, in which an estimated 2,000 died.
"The Muslim League formed militias and so did right-wing Hindu groups," says Dr Eleanor Newbigin, senior lecturer in South Asian history at SOAS, University of London.
"Terror groups would chase people out of their villages, to get more control for their own side."
Between 200,000 and one million people are estimated to have been killed or died of disease in refugee camps.
Tens of thousands of women, both Hindu and Muslim, were raped, abducted or disfigured.
What were the consequences of partition?
Since partition, India and Pakistan have repeatedly fought over who controls the province of Kashmir.
Why India and Pakistan fight over Kashmir
Kashmir profile - Timeline
My journey to the 'place no-one spoke of'
They have fought two wars over it (in 1947-8 and 1965), clashed in the 1999 Kargil crisis and currently administer different parts of it.
India also intervened to support East Pakistan in its war of independence against Pakistan, in 1971.
Less than 2% of Pakistan's population is now Hindu.
"Pakistan has become more and more Islamic," Dr Price says.
"That is partly because so many of its population are now Muslim and there are so few Hindus left there.
"And India is now coming more under the influence of Hindu nationalism."
Dr Newbigin says: "The legacy of partition is distressing.
"It has created powerful religious majorities in both countries.
"The minorities have become smaller and more vulnerable than they were before."
Prof Purewal says: "It may have been possible in 1947 to have created a united India.
"It could have been a loose federation of states, including states where Muslims were the majority.
"But Gandhi and Nehru both insisted on having a unified state, controlled from the centre.
"They did not really consider how a Muslim minority might live within that kind of country."