Zia-ul-Haq came to power in 1977 through a bloodless coup after disputed elections. He suspended the constitution and imposed martial law. Zia began a process of Islamization, banning alcohol and introducing Islamic punishments. The Soviet invasion of Afghanistan in 1979 had major effects on Pakistan, flooding it with refugees and bringing weapons and drugs. Zia used the Afghan war to build up Pakistan's military and nuclear program. He held a referendum in 1984 to extend his presidency for another 5 years. In 1988, Zia dismissed the elected Prime Minister Junejo and dissolved the assembly before dying in a plane crash later that year.