Hindus and Sikhs fled Pakistan, a country that would be Muslim-controlled. Muslims in modern-day India fled in the opposite direction.
The legacy of that violent separation has endured, resulting in a bitter rivalry between India and Pakistan. "When they partitioned, there were probably no two countries on Earth as alike as India and Pakistan," said Nisid Hajari, the author of "Midnight's Furies: The Deadly Legacy of India's Partition." "Leaders on both sides wanted the countries to be allies, like the U.S. and Canada are. Their economies were deeply intertwined, their cultures were very similar."
But after partition was announced, the subcontinent descended quickly into riots and bloodshed.
Bungalows and mansions were burned and looted, women were raped, children were killed in front of their siblings. Trains carrying refugees between the two new nations arrived full of corpses; their passengers had been killed by mobs en route. These were called "blood trains": "All too often they crossed the border in funereal silence, blood seeping from under their carriage doors," Hajari wrote in his book.
Even the fruit on the trees tasted of blood, recalls Sudershana Kumari, who fled from her home town in Pakistan to India. "When you broke a branch, red would come out," she said, painting an image of how much blood had soaked the soil in India.
Many who lived through those times describe madness taking hold. "Some people say they had temporarily gone crazy," Hajari said.
Archives on both sides have collected video and oral testimonies of the horrors. A partition museum will open this week in the Indian city of Amritsar, containing items that were brought over from Pakistan by refugees.
But outside southern Asia, the brutalities of partition were not widely broadcast. Partly, Hajari says, that may be because of how the events were depicted by British sources. "At the time, there was an impetus to portray the moment of independence as a triumph — that after 200 years of colonial rule, the British could part as friends. If you emphasize the death and violence, that tarnishes the achievement," he said.
And partly, he said, it may be because Indians and Pakistanis themselves still find it difficult to discuss those horrors openly and honestly. "It is still hard to understand why those things happened. Why did that temporary insanity take over?"
These are the stories of some of those who survived.
Sudershana Kumari, an 8-year-old Hindu girl who witnessed a massacre in her home town in Pakistan
Even as a girl, Sudershana Kumari's survival instincts were sharp enough to know that staying quiet is sometimes the best option.
Crying out would have given away her hiding place — a rooftop in her native town, Sheikhupura, where Kumari, her mother and dozens of others lay, watching the carnage on the streets below. "We couldn't show our heads," she said. "You show your head and you're dead."
Kumari's family is Hindu; they were living in an area that would soon become Muslim-dominated Pakistan. Families like hers would have to flee.
So Kumari, now 78, did not make a sound. Not when she felt pangs in her stomach after three days without food. Not even when she heard her dog Tom barking for her.
From the holes in the roof, Kumari saw her uncle and his family being killed by men with spears in the street. Her uncle was a tax collector who had made the error of filling their suitcases with cash — unnecessary weight that had kept his family from running fast enough, Kumari said. "My aunt was wearing white trousers, I remember," she says. "She was crying, 'Don't kill my son, don't kill my son.' Then they took her daughter from her. They took her, and they pierced the spear through her body. She died like that, a 1-year-old girl."
Kumari's family scattered. Her town had been reduced to ash and rubble. For days, she and her mother hid from rioters who were looking for Hindus to kill and loot.
When armed men eventually found them, they were hiding in an attic packed with about 300 others from the town.
The townspeople were ushered out to a playground, where the previous day's captives had been doused with oil and burned alive. Corpses lay strewn across the streets. "One dead body here, one dead body there. All people we know," Kumari said. "There's Khyaliram, there's Baleddiram."
Minutes before they were to be killed, a cease-fire was announced. Trucks rolled into the village from the cities, with Tara Singh, a famous political and religious leader known for his contributions to independence struggles, shouting at rioters through a megaphone. Not another drop of blood should be spilled, he was saying. They listened, because they respected him.
On the other side, they would become refugees — penniless, homeless strangers in a strange land.
Years later, Kumari had nothing left from those years besides a small box she stole from her burning town, thinking it could be used for her dolls to sleep in.
That and her memories. She fills notebooks with poems about those years. One of them reads:
Mind, don't dwell on things of the past
What do you get from it?
Your eyes will have to cry.
Your eyes will have to stay awake all night.
Your eyes will have to cry.
Hashim Zaidi, a Muslim whose family fled India for Pakistan, fearing repercussions after an uncle killed a Hindu man
If Hashim Zaidi and his family hadn't left his native town of Allahabad in India, the rioters would never have spared them.
His uncle, a Muslim police officer, had killed a Hindu rioter who was trying to enter his house, he said.
Violent acts of vengeance had become commonplace in 1947. Zaidi's family was taking no chances. "We had no choice but to leave India for Pakistan because of incessant attacks by rioters," he said.
Only 10 or 11 years old at the time, Zaidi was taken to Pakistan on a train. The carriages were marked to show which passengers were carrying money or other objects of value, and which ones weren't.
"They started it, and they murdered people to get their hands on money," he said. "People who have made it to Pakistan have given money in exchange for their lives."
"It was all about the loot and nothing to do with ideology," he said.
Sarjit Singh Chowdhary, a Sikh soldier who helped Muslim refugees reach safety in Pakistan
Sarjit Singh Chowdhary heard the news on the radio.
At the time, he was 2,000 miles away, serving as part of the British army in Iraq. News that partition was imminent and that his family may be in danger filled him with worry. He applied to be repatriated and was back on Indian soil by September 1947. "When I had left, India was a peaceful country," he said. "When I came back, it was bloodshed."
Killings had begun in March in his home town, Kahuta, in modern-day Pakistan. Later he would discover that his mother had been attacked. "My mother was a brave woman and knew how to fire a gun, so she was able to defend herself. She managed to escape and bring my siblings over to India," he said.
As a 24-year-old soldier, Chowdhary was appointed to serve for the Punjab police and put in charge of law and order amid the unrelenting violence in the region. "I saw the body of a dead man being thrown off a train," he recalled. "Once, on my way from Delhi to Jalandhar, we stopped at Doraha Canal and saw that the water had become red with blood."
The news reports from his home town disturbed him deeply. "In a village just 12 kilometers from mine called Thoha Khalsa, women drowned themselves to save their honor. When the army found them, their bodies were swollen and had come up to the surface. That was the state at the time. Men were shooting their own wives and daughters because they feared what would happen if they were taken away by attackers," he said.
Twice, he accompanied Muslim refugees across the border. "They had gathered in their villages, tied up all their things onto bullock carts. There were around 40 carts, a few hundred people," he said. "They wanted to get to Pakistan. They must have been sad to leave, but tell me, if your life, your family's life is in constant danger, wouldn't you want to get out?"
Mohammad Naeem, a Muslim boy who traveled to Pakistan on the notoriously dangerous 'blood trains'
Mohammad Naeem arrived in Lahore on a train from Agra, the city of the Taj Mahal, where he was born.
When the riots started, his Muslim family no longer felt safe in Hindu-majority India.
It was a dangerous journey. Many who traveled along the same route had been killed; their bodies littered the tracks.
His father, who was separated from the family amid the riots, had to take a ship from Mumbai.
He bought a ticket, even though others at the time were riding free. When he disembarked in Karachi, people asked him why he had bothered wasting the fare money. "He said: 'I'm a cowardly man. I bought the ticket so they don't throw me overboard.' "
Swati Gupta contributed from New Delhi to this report.