In other words, he assumed power through a military coup.
“However, Khamenei himself was not considered to have sufficient religious expertise when he was elected in 1989, so he relied on the Revolutionary Guards and a constitutional revision in order to become the supreme leader.”
Khamenei was the personal secretary to Khomeni, and was in with him when he died. He came out of the room with a surprise letter, supposedly the sudden last wishes of Khomeni, to appoint Khamenei his successor.
Khamenei is now the richest man in Iran.
I expect more palace intrique, in this winner take all/loser dies system.