After declaring British Policy regarding princely states, King Hari Sigh of Kashmir neither wanted to join Pakistan nor India.
But Pakistan wanted to capture Kashmir.
Soon Pakistan attacked Kashmir, King Hari Singh sought help from Pandit Jawaharlal Nehru.
Indian army had already started recapturing parts of the land which had been captured by the Pakistani army.
Meanwhile, UNO intervened in this matter and Pakistan and India had to stop the war. But by this decision, some parts of Kashmir remained occupied by Pakistan.
Later on, King Hari Singh was ready to merge in India. Special provisions were passed and through this Kashmir got special status under Article 370.