Khamenei was a key figure in the Islamic revolution in Iran and a close confidant of Ayatollah Khomeini.