Who took over when the shah of Iran lost power?

The Ayatollah were the ones to take over Iran when the shah of Iran lost power. They came in as a religious leader as a religious leader.