a war between Shi'ites and Sunnis," said Khamenei, who has the last word in the Islamic Republic's Shi'ite clerical administration.
Accusing Washington of using Sunni Islamists and loyalists of Saddam's Baath party, he added: "The U.S. is seeking an Iraq under its hegemony and ruled by its stooges." During Iran's long war with Saddam in the 1980s, Iraq enjoyed quiet U.S. support.
Tehran and Washington have been shocked by the lightning offensive, spearheaded by ISIL but also involving Sunni tribes and Saddam loyalists. It has seen swaths of northern and western Iraq fall, including the major city of Mosul on June 10.
Iranian President Hassan Rouhani criticised oil-rich Sunni Gulf states that he said were funding "terrorists" - a reference to the likes of Saudi Arabia and Qatar which have backed Sunni rebels against Syria's Iranian-backed leader, Bashar al-Assad.
"We emphatically tell those Islamic states and all others funding terrorists with their petrodollars that these terrorist savages you have set on other people's lives will come to haunt you," IRNA quoted Rouhani as saying on Sunday.
ISIL thrust east from a newly captured Iraqi-Syrian border post on Sunday, taking three towns in Iraq's western Anbar province after seizing the frontier crossing near the town of Qaim on Saturday, witnesses and security sources said.
They seized a second border post, al-Waleed, on Sunday.
The gains have helped ISIL secure supply lines to Syria, where it has exploited the chaos of the uprising against Assad to seize territory. It is considered the most powerful force among armed groups who seized Falluja, just west of Baghdad, and took parts of Anbar's capital Ramadi at the start of the year.
The fall of Qaim represented another step towards the realisation of ISIL's military goals - erasing a frontier drawn by colonial powers carving up the Ottoman empire a century ago.
ISIL's gains on Sunday included the towns of Rawa and Ana along the Euphrates river east of Qaim, as well as the town of Rutba further south on the main highway from Jordan to Baghdad. Jordan said traffic had stopped arriving from Iraq.
An Iraqi military intelligence official said Iraqi troops had withdrawn from Rawa and Ana after ISIL militants attacked the settlements late on Saturday. "Troops withdrew from Rawa, Ana and Rutba this morning and ISIL moved quickly to completely control these towns," the official said.
"They took Ana and Rawa this morning without a fight."
Military spokesman Major-General Qassim al-Moussawi said the