Ali Khamenei seemed an unlikely choice for supreme leader after the death of Ayatollah Ruhollah Khomeini