Pakistan was invented as a homeland for the sub-continent's Muslims. But the ruler of Kashmir, who had the choice of joining India or Pakistan, chose India, to the unassuagable fury of Pakistan's leaders. They assumed that, because Kashmir was predominantly Muslim, it would join Pakistan. Hence the war of 1947-48, when Pakistan tried to wrest it from India, and the war of 1965.