Why was the Indian subcontinent divided into two nations?

The Indian subcontinent was divided into two nations for religious reasons. The Hindus and the Muslims could not live in peace so they were divided.