Jamaat's rehabilitation began when Ziaur Rahman became president after a coup in 1975 and lifted the previous ban on religious parties. In 1977, Zia removed secularism in the constitution, replacing it with Islamic ideals, further clearing the way for Jamaat-e-Islami to return to political participation. In 1978, Azam returned to Bangladesh on a Pakistani passport with a temporary visa, and stayed as a Pakistani national until 1994 even after his visa expired; he refused to leave the country and continued to live in Bangladesh. His stay was however unwelcome in Bangladesh, and he was beaten by an angry mob at the footsteps of the Baitul Mukarram mosque while attending a funeral in 1981.