Yaar, when states were being given to Pakistan and India before Independence, Muslim states were being given to Pakistan. Kashmir wasn’t given to Pakistan althought it was Majority Muslim population. The ruler of Kashmir was Hindu himself and signed to India as India was the region with Hindu majority population. When Hari Singh realised that he should’ve signed to Pakistan, he started killing Muslims in Kashmir to make the Hindu population in Kashmir rise. Pakistan had to ‘invade kashmir’ as it was a state made to defend the Muslims of the Indian subcontinent.