He played a behind-the-scenes role in Iran’s Islamic revolution, served as president in the 1980s and dominated the country for more than three decades.