A secret deal being negotiated in Baghdad would perpetuate the American military occupation of Iraq indefinitely, regardless of the outcome of the US presidential election in November.

The terms of the impending deal, details of which have been leaked to The Independent, are likely to have an explosive political effect in Iraq. Iraqi officials fear that the accord, under which US troops would occupy permanent bases, conduct military operations, arrest Iraqis and enjoy immunity from Iraqi law, will destabilise Iraq's position in the Middle East and lay the basis for unending conflict in their country.

But the accord also threatens to provoke a political crisis in the US. President Bush wants to push it through by the end of next month so he can declare a military victory and claim his 2003 invasion has been vindicated. But by perpetuating the US presence in Iraq, the long-term settlement would undercut pledges by the Democratic presidential nominee, Barack Obama, to withdraw US troops if he is elected president in November.

Download the new Independent Premium app Sharing the full story, not just the headlines

The timing of the agreement would also boost the Republican candidate, John McCain, who has claimed the United States is on the verge of victory in Iraq – a victory that he says Mr Obama would throw away by a premature military withdrawal.

America currently has 151,000 troops in Iraq and, even after projected withdrawals next month, troop levels will stand at more than 142,000 – 10 000 more than when the military "surge" began in January 2007. Under the terms of the new treaty, the Americans would retain the long-term use of more than 50 bases in Iraq. American negotiators are also demanding immunity from Iraqi law for US troops and contractors, and a free hand to carry out arrests and conduct military activities in Iraq without consulting the Baghdad government.

The precise nature of the American demands has been kept secret until now. The leaks are certain to generate an angry backlash in Iraq. "It is a terrible breach of our sovereignty," said one Iraqi politician, adding that if the security deal was signed it would delegitimise the government in Baghdad which will be seen as an American pawn.

The US has repeatedly denied it wants permanent bases in Iraq but one Iraqi source said: "This is just a tactical subterfuge." Washington also wants control of Iraqi airspace below 29,000ft and the right to pursue its "war on terror" in Iraq, giving it the authority to arrest anybody it wants and to launch military campaigns without consultation.

Mr Bush is determined to force the Iraqi government to sign the so-called "strategic alliance" without modifications, by the end of next month. But it is already being condemned by the Iranians and many Arabs as a continuing American attempt to dominate the region. Ali Akbar Hashemi Rafsanjani, the powerful and usually moderate Iranian leader, said yesterday that such a deal would create "a permanent occupation". He added: "The essence of this agreement is to turn the Iraqis into slaves of the Americans."

Iraq's Prime Minister, Nouri al-Maliki, is believed to be personally opposed to the terms of the new pact but feels his coalition government cannot stay in power without US backing.

The deal also risks exacerbating the proxy war being fought between Iran and the United States over who should be more influential in Iraq.

Although Iraqi ministers have said they will reject any agreement limiting Iraqi sovereignty, political observers in Baghdad suspect they will sign in the end and simply want to establish their credentials as defenders of Iraqi independence by a show of defiance now. The one Iraqi with the authority to stop deal is the majority Shia spiritual leader, Grand Ayatollah Ali al-Sistani. In 2003, he forced the US to agree to a referendum on the new Iraqi constitution and the election of a parliament. But he is said to believe that loss of US support would drastically weaken the Iraqi Shia, who won a majority in parliament in elections in 2005.

The US is adamantly against the new security agreement being put to a referendum in Iraq, suspecting that it would be voted down. The influential Shia cleric Muqtada al-Sadr has called on his followers to demonstrate every Friday against the impending agreement on the grounds that it compromises Iraqi independence.

The Iraqi government wants to delay the actual signing of the agreement but the office of Vice-President Dick Cheney has been trying to force it through. The US ambassador in Baghdad, Ryan Crocker, has spent weeks trying to secure the accord.

The signature of a security agreement, and a parallel deal providing a legal basis for keeping US troops in Iraq, is unlikely to be accepted by most Iraqis. But the Kurds, who make up a fifth of the population, will probably favour a continuing American presence, as will Sunni Arab political leaders who want US forces to dilute the power of the Shia. The Sunni Arab community, which has broadly supported a guerrilla war against US occupation, is likely to be split.

Click here to have your say