BAGHDAD - Iraq and the U.S. are near an agreement on all American combat troops leaving Iraq by October 2010, with the last soldiers out three years after that, two Iraqi officials told The Associated Press on Thursday. U.S. officials, however, insisted no dates had been agreed.

The proposed agreement calls for Americans to hand over parts of Baghdad's Green Zone -- where the U.S. Embassy is located -- to the Iraqis by the end of 2008. It would also remove U.S. forces from Iraqi cities by June 30, 2009, according to the two senior officials, both close to Iraqi Prime Minister Nouri al-Maliki and familiar with the negotiations.

The officials, who spoke separately on condition of anonymity because the talks are ongoing, said all U.S. combat troops would leave Iraq by October 2010, with the remaining support personnel gone "around 2013." The schedule could be amended if both sides agree -- a face-saving escape clause that would extend the presence of U.S. forces if security conditions warrant it.

U.S. acceptance -- even tentatively -- of a specific timeline would represent a dramatic reversal of American policy in place since the war began in March 2003.

Both Iraqi and American officials agreed that the deal is not final and that a major unresolved issue is the U.S. demand for immunity for U.S. soldiers from prosecution under Iraqi law.

Throughout the conflict, President Bush steadfastly refused to accept any timetable for bringing U.S. troops home. Last month, however, Bush and al-Maliki agreed to set a "general time horizon" for ending the U.S. mission.

Bush's shift to a timeline was seen as a move to speed agreement on a security pact governing the U.S. military presence in Iraq after the U.N. mandate expires at the end of the year.

Iraq's Shiite-led government has been holding firm for some sort of withdrawal schedule -- a move the Iraqis said was essential to win parliamentary approval.

The U.S. Embassy in Baghdad declined to comment on details of the talks. Embassy spokeswoman Mirembe Nangtongo said the negotiations were taking place "in a constructive spirit" based on respect for Iraqi sovereignty.

In Washington, U.S. officials acknowledged that some progress has been made on the timelines for troop withdrawals but that the immunity issue remained a huge problem. One senior U.S. official close to the discussion said no dates have been agreed upon.

They spoke on condition of anonymity because the negotiations have not been finished.

But the Iraqis insisted the dates had been settled preliminarily between the two sides, although they acknowledged that nothing is final until the entire negotiations have been completed.

One Iraqi official said persuading the Americans to accept a timetable was a "key achievement" of the talks and that the government would seek parliamentary ratification as soon as the deal is signed.

But differences over immunity could scuttle the whole deal, the Iraqis said. One of the officials described immunity as a "minefield" and said each side was sticking by its position.

One official said U.S. negotiator David Satterfield told him that immunity for soldiers was a "red line" for the United States. The official said he replied that issue was "a red line for us too."

The official said the Iraqis were willing to grant immunity for actions committed on American bases and during combat operations -- but not a blanket exemption from Iraqi law.

The Iraqis also want American forces hand over any Iraqi they detain. The U.S. insists that detainees must be "ready" for handover, which the Iraqi officials assume means the Americans want to interrogate them first.

As the talks drag on, American officials said the Bush administration is losing patience with the Iraqis over the negotiations, which both sides had hoped to wrap up by the end of July.

Secretary of State Condoleezza Rice and al-Maliki had a long and "very difficult" phone conversation about the situation on Wednesday during which she pressed the Iraqi leader for more flexibility particularly on immunity, one U.S. senior official said.

"The sovereignty issue is very big for the Iraqis and we understand that. But we are losing patience," the official said. "The process needs to get moving and get moving quickly."

The official could not say how long the call lasted but said it was "not brief" and "tense at times."

In London, Britain's defense ministry said it is also in talks with Iraq's government over the role of British troops after the U.N. mandate runs out. Prime Minister Gordon Brown recently said that early next year Britain will reduce its troops in Iraq, now at about 4,100, and that Britain's role in the country will change fundamentally.

Iraq's position in the U.S. talks hardened after a series of Iraqi military successes against Shiite and Sunni extremists in Basra, Baghdad, Mosul and other major cities and after the rise in world oil prices flooded the country with petrodollars.

As the government's confidence rose, Iraqi officials believed they were in a strong negotiating position -- especially with the presumptive Democratic presidential nominee, Sen. Barack Obama, pledging to remove all combat forces within his first 16 months in office if security conditions allow.

Standing firm against the Americans also enhances al-Maliki's nationalist credentials, enabling him to appeal for support from Iraqis long opposed to the U.S. presence.

On Thursday, a spokesman for Muqtada al-Sadr said the Shiite cleric will call on his fighters to maintain a cease-fire against American troops -- but may lift the order if the security agreement fails to contain a timetable for a U.S. withdrawal.

The statement by Sheik Salah al-Obeidi came as al-Sadr planned to spell out details of a formula to reorganize his Mahdi Army militia by separating it into an unarmed cultural organization and elite fighting cells.

The announcement is expected during weekly Islamic prayer services on Friday.

"This move is meant to offer an incentive for the foreign forces to withdraw," al-Obeidi said. "The special cells of fighters will not strike against foreign forces until the situation becomes clear vis-a-vis the Iraq-U.S. agreement on the presence of American forces here."

Several cease-fires by al-Sadr have been key to a sharp decline in violence over the past year. But American officials still consider his militiamen a threat and have backed the Iraqi military in operations to try to oust them from their power bases in Baghdad and elsewhere in Iraq.