Iran's supreme leader accused the United States of trying to retake control of Iraq by exploiting sectarian rivalries, as Sunni insurgents drove toward Baghdad from new strongholds along the Syrian border.
Ayatollah Ali Khamenei's condemnation of US action came three days after President Barack Obama offered to send 300 military advisers to help the Iraqi government.
Militants have overran a second post on the Syrian border, extending two weeks of swift territorial gains as the Islamic State of Iraq and Syria (ISIS), also known as ISIL, pursues the goal of its own power base, a "caliphate" straddling both countries that has raised alarm across the Middle East and in the West.
"We are strongly opposed to US and other intervention in Iraq," IRNA news agency quoted Mr Khamenei as saying. "We don't approve of it as we believe the Iraqi government, nation and religious authorities are capable of ending the sedition."
Speaking in Cairo, Secretary of State John Kerry said the US wanted Iraqis to find a leadership that would represent all the country's communities - though he echoed Obama in saying it would not pick or choose those leaders: "The United States would like the Iraqi people to find leadership that isprepared to represent all of the people of Iraq, that isprepared to be inclusive and share power," Mr Kerry said.
The Iranian and the US governments had seemed open to collaboration against ISIS, which is also fighting the Iranian-backed president of Syria, who the US want to see removed.
"American authorities are trying to portray this as a sectarian war, but what is happening in Iraq is not a war between Shias and Sunnis," said Mr Khamenei, who has the last word in the Islamic Republic's Shia clerical administration.
The gains have helped ISIS secure supply lines to Syria,where it has exploited the chaos of the uprising against President Bashar al-Assad to seize territory.
It is considered the most powerful force among armed groups who seized Fallujah, 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 ISIS's military goals, erasing a frontier drawn by colonial powers carving up the Ottoman empire a century ago.
ISIS'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.
A military intelligence official said Iraqi troops had withdrawn from Rawa and Ana after ISIS militants attacked the settlements late on Saturday.
"Troops withdrew from Rawa, Anaand Rutba this morning and ISIL moved quickly to completelycontrol these towns," the official said.
"They took Ana and Rawa this morning without a fight."
Military spokesman Major-General Qassim al-Moussawi said the withdrawal from the towns was intended to ensure "command and control" and to allow troops to regroup and retake the areas.
The towns are on a strategic supply route between ISIS’s positions in northwestern Iraq and eastern Syria, where the group has taken a string of towns and strategic positions from rival Sunni forces fighting Mr Assad’s forces over the past few days.
The last major Syrian town not in ISIS's hands in the region, the border town of Albukamal, is controlled by the Nusra Front, al Qaeda's branch in Syria which has clashed with ISIS.
Disowned by al Qaeda in February after defying the global leadership to pursue its own goals in Syria, ISIS has pushed south down the Tigris valley since capturing Mosul with barely a fight, occupying towns and taking large amounts of weaponry from the collapsing, US-trained Iraqi army.
Overnight, ISIS fighters attacked the town of al-Alam, north of Tikrit, according to witnesses and police in the town. The attackers were repelled by security forces and tribal fighters, they said, adding that two ISIS fighters had been killed.
State television reported that "anti-terrorism forces" in coordination with the air force had killed 40 ISIS members and destroyed five vehicles in Tikrit.
There has been a lull in fighting at Iraq's largest refinery, Baiji, near Tikrit, on Sunday.
The site had been a battlefield since Wednesday as Sunni fighters launched an assault on the plant. Militants entered the large compound but were repelled by Iraqi military units. The fighters now surround the compound.
At least 17 soldiers and volunteers were killed in overnight clashes with ISIS militants in the Saied Ghareeb area near Dujail, 50 km north of Baghdad, army and medical sources said.
Near the city of Ramadi, west of the capital, a suicide bomber and a car bomb killed six people at a funeral for an army officer killed the previous day.