Modern Pakistanis are a blend of their Harappan, Aryan, Persian, Greek, Saka, Parthian, Kushan, White Hun, Afghan, Arab, Turkic, and Mughal heritage. Waves of invaders and migrants settled down in Pakistan through out the centuries, influencing the locals and being absorbed among them. Thus the region encompassed by modern-day Pakistan is home to the oldest Asian civlization (and one of the oldest in the world after Mesopotamia and Egypt), Indus Valley Civilization (2500 BC - 1500 BC). The modern state of Pakistan was established on 14 August 1947, but the region it encompasses has an extensive history that overlaps with the histories of Ancient India, Iran and Afghanistan. The region was a crossroads of historic trade routes, including the Silk Road, and was settled over thousands of years by many groups, including Dravidians, Indo-Aryans, Persians, Greeks, Scythians, Parthians Kushans, White Huns, Afghans, Arabs, Turks, and Mongols; the region is often referred to as "a museum of races." Historian and geographer de Blij Muller characterized the historical embodiment of the land when he said, "If, as is so often said, Egypt is the gift of the Nile, then Pakistan is the gift of the Indus." The earliest evidence of humans are pebble tools from the Soan Culture in the province of Punjab, dated from 100,000 to 500,000 years ago. The Indus region was the site of several ancient cultures including Mehrgarh, one of the world's earliest known towns, and the Indus Valley Civilisation at Harrappa and Mohenjo-Daro.
The Indus Valley Civilisation collapsed in the middle of the second millennium BCE and was followed by the Vedic Civilisation, which extended over much of northern India and Pakistan. Successive empires and kingdoms ruled the region from the Achaemenid Persian empire around 543 BCE, to Alexander the Great Plutarch in 326 BCE and the Mauryan empire. The Indo-Greek Kingdom founded by Demetrius of Bactria included Gandhara and Punjab from 184 BCE, and reached its greatest extent under Menander, establishing the Greco-Buddhist period with advances in trade and culture. The city of Taxila (Takshashila) became a major centre of learning in ancient times - the remains of the city, located to the west of Islamabad, are one of the country's major archaeological sites.
In 712 CE, the Arab general Muhammad bin Qasim conquered Sindh and Multan in southern Punjab, setting the stage for several successive Muslim empires including the Ghaznavid Empire, the Ghorid Kingdom, the Delhi Sultanate and the Mughal Empire. During this period Sufi missionaries played a pivotal role in converting a majority of the regional Hindu population to Islam. The gradual decline of the Mughal Empire in the early eighteenth century provided opportunities for the Afghans, Balochis and Sikhs to exercise control over large areas until the British East India Company gained ascendancy over South Asia.
The War of Independence in 1857 was the region's last major armed struggle against the British Raj, and it laid the foundations for the generally unarmed freedom struggle led by the Congress. However, the Muslim League rose to popularity in the late 1930's amid fears of under-representation and neglect of Muslims in politics. On 29 December 1930, Allama Iqbal's presidential address called for a separate Muslim state in northwest and eastern South Asia. Muhammad Ali Jinnah espoused the Two Nation Theory and led the Muslim League to adopt the Lahore Resolution of 1940, which ultimately led to the creation of Pakistan.
Pakistan was formed on 14 August 1947 with two Muslim-majority wings in the eastern and northwestern regions of South Asia, separated by Hindu-majority India, and comprising the provinces of Balochistan, East Bengal, the North-West Frontier Province, West Punjab and Sindh. The partition of British India resulted in communal riots across India and Pakistan—millions of Muslims moved to Pakistan and millions of Hindus and Sikhs moved to India. Disputes arose over several princely states including Jammu and Kashmir whose King had acceeded to India and finally led to the First Kashmir War (1948) ending with Pakistan and India each occupying large parts of the state. From 1947 to 1956, Pakistan was a Dominion in the Commonwealth of Nations. The republic declared in 1958 was stalled by a coup d'etat by Ayub Khan (1958–69), who was president during a period of internal instability and a second war with India in 1965. His successor, Yahya Khan (1969–71) had to deal with the cyclone which caused 500,000 deaths in East Pakistan. Economic and political dissent in East Pakistan led to violent political repression and tensions escalating into civil war (Bangladesh Liberation War) and the Indo-Pakistani War of 1971 and ultimately the secession of East Pakistan as the independent state of Bangladesh.
Civilian rule resumed from 1972 to 1977 under Zulfikar Ali Bhutto, until he was deposed and later sentenced to death in what accounts to a judicial murder in 1979 by General Zia-ul-Haq, who became the third military president. Pakistan's secular policies were replaced by Zia's introduction of the Islamic Shariat legal code, which increased religious influences on the civil service and the military. With the death of General Zia in a plane crash in 1988, Benazir Bhutto, daughter of Zulfikar Ali Bhutto, was elected as the first female Prime Minister of Pakistan. Over the next decade, she alternated power with Nawaz Sharif, as the country's political and economic situation worsened. Pakistan sent 5,000 troops to the 1991 Gulf War as part of a US led coalition and specifically for the defence of Saudi Arabia.
Military tensions in the Kargil conflict with India in 1999 was followed by a military coup in which General Pervez Musharraf assumed executive powers. In 2001, Musharraf became President after the resignation of Rafiq Tarar. After the 2002 parliamentary elections, Musharraf transferred executive powers to newly elected Prime Minister Zafarullah Khan Jamali, who was succeeded in the 2004 Prime-Ministerial election by Shaukat Aziz.