A supporter and former pupil of Ayatollah Khomeini, in 1978 he helped organize the mass demonstrations that led to the shah’s overthrow the following year. In 1988 he helped to bring an end to the Iran–Iraq War, having persuaded Khomeini to accept the UN’s peace terms. When Khomeini died in 1989 Rafsanjani emerged from the ensuing power struggle as Iran’s leader. He sought to improve Iran’s relations with the West, and kept his country neutral during the Gulf War of 1991. He stood unsuccessfully in the 2005 presidential election and was barred from standing in 2013.