Pakistan's powerful military says it is taking "no direct role" in the July 25 election, but a history of coups and dictatorships is fuelling fears over the balance of power in civil-military relations. Here is a brief overview of Pakistan's troubled path to democracy under the shadow of military rule.
Liberation chaos and the first coup
Pakistan is created as a homeland for Muslims in 1947 as the subcontinent gains independence from Britain. But its founder, the venerated Mohammad Ali Jinnah, dies one year later. Over the next decade some seven prime ministers come and go before the military finally has enough of the chaos, with General Ayub Khan launching the country's first military coup in 1958. He is succeeded by General Yahya Khan in 1969 in the face of mass unrest, but Pakistan does not come back under civilian leadership until a disastrous civil war sees East Pakistan splinter away to form Bangladesh in 1971. Khan hands over the presidency to Zulfiqar Ali Bhutto that same year.
Bhutto's hanging and the second coup
Bhutto, founder of the populist Pakistan Peoples Party (PPP), appoints a new army chief in 1976 -- General Zia-ul-Haq -- a surprise promotion that some say reflected the prime minister's view that Zia was no threat. If so, it proves a wild miscalculation. Not only does Zia depose Bhutto in the country's second coup in 1977, he jails the prime minister and, two years later, has him hanged. Zia's totalitarian rule sees him impose Islamic laws and organise sham elections. He remains in power until he is killed in 1988, when his Hercules C-130 aircraft mysteriously crashes in Pakistan.
Benazir, Nawaz, and the third coup
Zia's death ushers civilian rule back in under the leadership of his old nemesis Bhutto's daughter, Benazir, who becomes the first female leader of any Muslim country. She leads from 1988 until 1990, when she is ousted on corruption charges that she insinuates were fuelled by the military. She is replaced by Nawaz Sharif, in the Pakistan Muslim League-Nawaz (PML-N) leader's first stint as prime minister, setting in place a paradigm of revolving leadership between the two politicians that continues until the army, once again, loses patience. By 1999, the relationship between Sharif in his second stint as premier and then-army chief General Pervez Musharraf is rapidly deteriorating. Musharraf ousts Sharif in the country's third coup.
From Musharraf into democracy?
Musharraf names himself president in 2001 while remaining head of the army. He allows parliamentary and provincial elections in 2002, with his Pakistan Muslim League Quaid-i-Azam (PML-Q) winning a majority amid allegations of massive vote fraud. General elections are finally held in 2008, weeks after Benazir Bhutto is assassinated. Musharraf concedes defeat and the PPP eventually forms a coalition government with Yousaf Raza Gilani as prime minister. Gilani is not allowed to complete his term, ousted in 2012 over contempt of court charges, and is replaced by Raja Pervaiz Ashraf. The 2013 elections represent Pakistan's first ever democratic transfer of power. Nawaz Sharif, who went into exile after the 1999 coup but returned to the country in 2007, wins the contest in his most stunning comeback yet, becoming prime minister for the third time.
Nawaz vs a 'silent coup'
Sharif again clashes with the military, this time over his efforts to seek better relations with arch-rival India. He is ousted by the Supreme Court following a corruption investigation in 2017, and banned from politics for life. He denies the allegations and loudly claims he is being targeted by the military. An election is called for July 25. Sharif is sentenced to 10 years in prison for corruption and later arrested. It is widely believed that Imran Khan, leader of the Pakistan Tehreek-e-Insaf (PTI) party, will benefit from the turmoil and may have links to the army. Media, activists and analysts decry pressure from security institutions, "unabashed" pre-poll rigging, and even a "silent coup". The military denies the claims.