Iran's opposition appears to be a major reason why, after eight months of arduous negotiations, the United States and Iraq have so far failed to reach agreement on a Status of Forces Agreement (SOFA), although such an agreement is urgently required. The UN Resolution, which authorised the deployment of US and Coalition forces in Iraq, expires on December 31.

After that date, stripped of legal cover, US forces would have to be confined to their bases, and prepare to withdraw from Iraq, as Iraqi Prime Minister Nouri Al Maliki himself explained (in an interview with The Times of London on October 13).

Some sort of a stop-gap arrangement is therefore necessary until an agreement on SOFA can be reached. It could take the form of a short extension of the UN Resolution by the Security Council, or a simple hand-shake agreement between President George W. Bush and Al Maliki.

Iran, meanwhile - and its main ally in Iraq, Moktada Al Sadr's movement, which last week staged a large demonstration against SOFA - are putting pressure on the Iraq government not to sign. Iran's view is that any sort of SOFA - even a watered down one which restricts the operational freedom of US troops and reduces their legal immunity - would nevertheless serve to perpetuate the American military presence in Iraq. And the last thing Iran wants is US bases on the territory of its neighbour.

Indeed, Iran would wish to see the withdrawal of US forces, not only from Iraq, but from the entire Gulf region. US-Iranian competition across the Middle East - in the Gulf, Afghanistan, Lebanon and in the Palestinian arena - is now a prominent feature of the regional political scene.

John McCain, the Republican presidential candidate, has indicated that he would favour long-term US bases in Iraq, on the model of the US presence in Japan and South Korea. In contrast, Barack Obama, his Democratic rival, has spoken of withdrawing US combat troops from Iraq within 16 months of his taking office. But he, too, seems to envisage a residual US military presence, if only for keeping Al Qaida at bay.

The very first sentence of the Pentagon's latest report to Congress about the situation in Iraq, dated September 26, states that "The strategic goal of the United States in Iraq remains a unified, democratic and federal Iraq that can govern, defend and sustain itself and is an ally in the war on terror."

Clearly, after the immense cost of the war, the US must surely hope to keep Iraq, economically and strategically, in its orbit. But, for the moment at least, the trend is running the other way. The US seems to be heading for the exit,

Does this mean that Iran has won the contest for Iraq? Far from it. Not all Iraqi Shiite groups are friendly to Iran or welcome Iranian interference in their country. The eight-year Iran-Iraq war, 1980-88, proved that the humble soldiery of the Iraqi army - the largely Shiite rank and file - were prepared to fight and die in the struggle against Iran. The war was, in fact, a confirmation of Iraqi nationalism.

Although they share with Iran the same sectarian Islamic beliefs, most Iraqi Shiites are proud of their Arab identity and their Arab tribal affiliations. They are not prepared to fall under Iranian domination. The Iraqi city of Najaf, which had been weakened by Saddam Hussain's repression, is now re-emerging as an Arab centre of Shiite learning and theological teaching, in competition with Qom, the principal Iranian centre of Shiites.

Petition signed

Earlier this year, some three million Iraqi Shiites signed a petition against Iranian intervention in Iraqi affairs. Perhaps the clearest sign of declining Iranian influence in Iraq is the decision of Moktada Al Sadr to stand down his militia, the Mahdi army. He himself is said to have withdrawn to a seminary in Iran.

Prime Minister Al Maliki, who has politically reinforced his position by using the Iraqi army to subdue Shiite militias in Basra, Sadr City and elsewhere, is himself a symbol of emerging Iraqi nationalism. His Da'wa party was persecuted and hunted down by Saddam Hussain, forcing him to spend some 20 years in exile in Iran and Syria. But he is far from being a puppet of either country.

His ambition would seem to be to rebuild Iraq as a major Middle East player - this time, however, as a Shiite rather than as a Sunni power, as it was under Saddam Hussain. Some observers believe that Al Maliki and his allies, principally the Supreme Islamic Iraqi Council, wish to establish a strong Iraqi nationalist state in the form of a Shiite Islamic republic.

Some evidence of this may be seen in his actions - in his care that any SOFA agreement with the US should not encroach on Iraqi sovereignty and independence; in his firm, if friendly, relations with Iran; and in his bold use of the Iraqi army against Shiite militias and undisciplined gangs, which were terrorising the local population.

It may also be seen in his clear statement (in The Times interview) that Kirkuk "is a city that belongs to the federal government and is outside the boundaries of the Kurdistan region".

This is a clear warning to the Kurds that there are strict limits to Shiite tolerance of their ambitions.

Perhaps the clearest indication of Al Maliki's position lies in his treatment of the Sunni tribal force, the so-called Sons of Iraq, now nearly 100,000 strong, raised, funded and armed by the US to fight Al Qaida, which it has done with reasonable success in provinces such as Al Anbar.

The United States has been pressing Al Maliki to incorporate the Sons of Iraq into the Iraqi National Army. Al Maliki has promised to do so, but has dragged his feet, no doubt because he sees this force, which includes many Ba'athists and former insurgents, as a potential rival for power.

Although overall security has improved, great problems remain. The internal political scene is chaotic, with numerous factions each seeking to impose their own agenda. There are an estimated 2.8 million displaced persons inside Iraq and a further two million refugees outside it, mainly in Syria and Jordan. Basic services are still rudimentary. An estimated $400 billion (Dh1.46 trillion) is needed to rebuild the country's shattered infrastructure.

Patrick Seale is a commentator and author of several books on Middle East affairs.