Iran's president says Syrian leader Bashar Assad must remain in power to fight extremist groups like the Islamic State, and must not be weakened.

Hassan Rouhani told a meeting Sunday evening with scholars and think tank experts that Iran will cooperate with any country that puts fighting and defeating "terrorism" as its top priority — but it cannot work with any government that makes a change in Syria's regime its top priority.

Rouhani's view puts Iran at odds with key nations who adopted a roadmap in Geneva in June 2012 which calls for the formation of a transitional government in Syria with full executive powers "on the basis of mutual consent."

Rouhani warned that putting regime change first would lead to an extremist takeover of Syria.