When the British left, millions of Hindus fled to India, and millions of Muslims poured into Pakistan. This left Pakistan with a shortage of trained workers, because the Hindus had held most of the skilled jobs in both business and in the professions. Religious riots broke out in both countries, and an undeclared, inconclusive war was fought over Kashmir. Pakistan gained control over the northwestern portions—including Gilgit, Baltistan, and Azad (Free) Kashmir. India retained the Vale of Kashmir.
In 1956 Pakistan adopted a constitution under which it became the Islamic Republic of Pakistan. In 1958 Gen. Mohammad Ayub Khan came to power in a bloodless revolution. He was elected president in 1960, and he proclaimed a new constitution in 1962. Pakistan's administrative capital was moved from Karachi to Rawalpindi in 1959 and then to Islamabad in 1967.
In 1960 Pakistan and India agreed to share the waters of the Indus River system for irrigation. The Kashmir dispute erupted again in 1965 but was ended by a United Nations (UN)