* Sharpest rejection by Iran of U.S. aid for mutual Iraqi ally
* ISIL militants capture second Syria-Iraq border post
* Kerry calls for more inclusive leadership in Baghdad
* Towns along Euphrates open supply route for militants (Adds clashes in Syria, ISIL using U.S.-made Humvees, Jordanian border)
By Kamal Namaa
ANBAR, Iraq, June 22 (Reuters) - Iran's supreme leader accused the United States on Sunday 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 U.S. action came three days after President Barack Obama offered to send 300 military advisers to help the Iraqi government. Khamenei may want to block any U.S. choice of a new prime minister after grumbling in Washington about Shi'ite premier Nuri al-Maliki.
The supreme leader did not mention the Iranian president's recent suggestion of cooperation with Shi'ite Tehran's old U.S. adversary in defence of their mutual ally in Baghdad.
On Sunday, militants overran a second frontier post on the Syrian border, extending two weeks of swift territorial gains as the Islamic State of Iraq and the Levant (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 U.S. and other intervention in Iraq," IRNA news agency quoted 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."
Some Iraqi observers interpreted his remarks as a warning not to try to pick its own replacement for Maliki, whom many in the West and Iraq hold responsible for the crisis. In eight years in power, he has alienated many in the Sunni minority that dominated the country under ousted dictator Saddam Hussein.
Khamenei has not made clear how far Iran itself will back Maliki to hold on to his job once parliament reconvenes following an election in which Maliki's bloc won the most seats.
Speaking in Cairo, Secretary of State John Kerry said the United States 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 is prepared to represent all of the people of Iraq, that is prepared to be inclusive and share power," Kerry said.
The Iranian and the U.S. governments had seemed open to collaboration against ISIL, which is also fighting the Iranian-backed president of Syria, whom Washington wants 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 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 swathes 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, 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 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 ISIL'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 Assad over the past few days.
The last major Syrian town not in ISIL'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 ISIL.
A monitoring group said on Sunday that ISIL fighters in northern Syria had for the first time been seen using U.S.-made Humvee all-terrain vehicles seized from the Iraqi army.
Disowned by al Qaeda in February after defying the global leadership to pursue its own goals in Syria, ISIL 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, U.S.-trained Iraqi army.
Overnight, ISIL 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 ISIL fighters had been killed.
State television reported that "anti-terrorism forces" in coordination with the air force had killed 40 ISIL members and destroyed five vehicles in Tikrit, Saddam's home town.
There was 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.
A black column of smoke rose from the site Sunday. Refinery officials said it was caused by a controlled burning of waste.
At least 17 soldiers and volunteers were killed in overnight clashes with ISIL militants in the Saied Ghareeb area near Dujail, 50 km (30 miles) 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.
Relations between diverse Sunni fighting groups have not been entirely smooth. On Sunday morning, clashes raged for a third day between ISIL and Sunni tribes backed by the Naqshbandi Army, a group led by former army officers and Baathists, around Hawija, local security sources and tribal leaders said.
More than 10 people were killed in clashes in the area, southwest of Kirkuk, the sources said. On Friday, ISIL and Naqshbandi fighters began fighting each other in Hawija. Iraqi and Western officials have argued that ISIL and other Sunni factions may turn on each other after capturing territory.
The fighting has threatened to tear the country apart for good, reducing Iraq to separate Sunni, Shi'ite and ethnic Kurdish regions. It has highlighted divisions among regional powers, notably between Iran and Saudi Arabia.
Iraq's Kurds have meanwhile expanded their territory beyond their autonomous region in the northeast, notably taking over the long-prized oil city of Kirkuk. Two Kurdish militiamen were killed by a roadside bomb there on Sunday, a police source said.
The government has mobilised Shi'ite militias and other volunteers to fight on the frontlines and defend the capital - thousands of fighters in military fatigues marched in a Shi'ite slum of the capital Baghdad on Saturday. (Additional reporting by a correspondent in Tikrit, Ahmed Rasheed and Raheem Salman in Baghdad and Mehrdad Balali in Dubai; Writing by Alexander Dziadosz and Ned Parker; Editing by Alastair Macdonald)
Our Standards: The Thomson Reuters Trust Principles.