President Dmitry Medvedev warned on Tuesday that Islamist extremists were trying to rip Russia apart and that a wave of unrest across the Arab world could spark decades of strife by ushering fanatics into power.

In his first major comments on the unrest that has shaken strong-man rulers across North Africa and the Middle East, Medvedev warned that some countries could fall apart.

These states are not simple and it is quite likely that complicated developments may occur, including the rise of fanatics to power -- this would mean decades of flames and the spread of extremism, let's look the truth in the eye, Medvedev was quoted as saying.

They prepared such a scenario for us before and... they are trying to do it now. In any case, this attempt will fail, Medvedev told security officials in Vladikavkaz, a city in Russia's North Caucasus.

Russia is fighting a growing Islamist insurgency in the mainly Muslim regions along its southern flank, where endemic corruption and grinding poverty has helped to drive youths into the hands of Islamist rebels.