Since its independence in 1947, Pakistan has oscillated between military and civilian forms of government. The political system has been marked by instability and prolonged military influence. The army has run the country directly for almost half of its past 50 years. The first prime minister, Liaquat Ali Khan, was assassinated in 1951. A brief attempt at civilian government, marked by considerable upheaval, ended when Field Marshal Ayub Khan took power in 1958. He was then removed by General Agha Mohammed Yahya Khan in 1969. Yahya Khan's role as ruler ended when Zulfikar Ali Bhutto was appointed as prime minister in 1973. The Pakistan People's Party (PPP) led by Bhutto won most of the seats in the March 1977 election, but General Zia ul Haq declared martial law and suspended all political activities, following allegations of electoral fraud and subsequent unrest. In October 1979, political restrictions were tightened, and Zia ordered the elections in February 1985 to be held on a non-party basis.
Although a civilian government resumed control after the February 1985 elections, the army's influence on politics continued. Complete civilian rule was not restored until Zulfikar Ali Bhutto's daughter, Benazir Bhutto, was elected as prime minister by the National Assembly in December 1988. Gulam Ishaq Khan, who had become president after Zia ul Haq, accused the government of corruption and dismissed Bhutto in August 1990. Subsequently, Nawaz Sharif, leader of the Islamic Democratic Alliance (IDA), was sworn in as prime minister on 6 November 1990. Sharif's service, however, was interrupted on 18 April 1993 when President Ishaq Khan dismissed his government after Sharif tried to curtail the president's constitutional power. Although Sharif was reinstated by the Supreme Court, both he and Ishaq Khan were forced to step down on 18 July 1993 under pressure from the army.
In the elections of October 1993, Benazir Bhutto's PPP gained a victory and she was inaugurated on October 19. Serdar Farooq Ahmad Khan Leghari became the new president on 14 November 1993. Leghari and Bhutto's elections, however, did not bring stability to Pakistani politics. Leghari dismissed Bhutto's highly unpopular government in November 1996 and established a new National Defense and Security Council (NDSC) which included the country's four most senior military men. Nawaz Sharif was returned to power on 3 February 1997, when his Pakistan Muslim League-Nawaz (PML-N) party won a landslide victory. The new prime minister greatly strengthened his hold on power when, in April 1997, the National Assembly and the Senate unanimously repealed key elements of the 1985 Eighth Constitutional Amendment. This divested the president of the power to appoint and dismiss the prime minister, cabinet, the legislature, provincial governors, and armed forces chiefs. Meanwhile, in May 1998, Pakistan detonated a series of nuclear bombs, establishing itself as a nuclear armed power, the second on subcontinent after India. This move brought wide international protests and in response the U.S. cut off military and economic aid to the country, causing widespread protests among Pakistanis, dismayed at the directions of the government. In October 1999, Nawaz Sharif attempted to dismiss his own Army Chief and Chairman Joint Chiefs of Staff Committee, General Pervez Musharraf. This led to a military coup on 12 October 1999, with General Musharraf taking over the reins of government.