"We strongly oppose the intervention of the US and others in the domestic affairs of Iraq," Khamenei was quoted as saying, in his first reaction to the crisis.
"The main dispute in Iraq is between those who want Iraq to join the US camp and those who seek an independent Iraq," said Khamenei, who has the final say over government policies.
Khamenei said Iraq's government and its people, with help of top clerics, would be able to end the "sedition" there, saying extremists are hostile to both Shiites and Sunnis who seek an independent Iraq.
Earlier today Iran's President Hassan Rouhani said some countries "feed terrorists by their petrodollars," in a veiled reference to the Arab Gulf states, and warned that such support would come back to haunt them.
Also Read
"Rest assured, tomorrow will be your turn. The barbarous terrorists will go after supporters of terrorism in the future," said Rouhani.
The commander of Iran's elite Quds Force, Gen Ghasem Soleimani, was reportedly in Iraq last week to consult with the government there on how to stave off insurgents' gains.
Soleimani's forces are a secretive branch of Iran's Revolutionary Guard that in the past has allegedly organised Shiite militias to target US troops in Iraq and, more recently, was involved in helping Syria's President Bashar Assad in his fight against Sunni rebels.
The Iraqi dictator Saddam Hussein fought an eight-year war with Iran in the 1980s that left more than a million dead on both sides. Many current Iraqi leaders spent years in exile in Iran.