US troops' immunity from Iraqi law has been a controversial issue
US combat troops could leave Iraq by 2011 under the terms of a deal awaiting approval by Iraq's parliament and presidency, an Iraqi official has said.
The draft security agreement also calls for US forces to withdraw from all Iraqi urban areas by June 2009.
The 27-point agreement reportedly includes a compromise allowing US soldiers some immunity under Iraqi law.
The final date when US troops leave will depend largely on security, the BBC's Crispin Thorold in Baghdad says.
The decision will be taken by a joint committee, which could reduce or extend the amount of time US troops spend in the country.
Mohammed al-Haj Hammoud, the top Iraqi official negotiating with the US on the status of US forces in Iraq, said a deal had been agreed that envisaged all US combat troops leaving Iraq by 2011.
Some US troops could remain beyond 2011 "to train Iraqi security forces", the AFP news agency quoted him as saying.
"The combat troops will withdraw from Iraqi cities by June 2009," Mr Hammoud said.
"Both the parties have agreed on this... The negotiators' job is done. Now it is up to the leaders."
A deal also appears to have been struck on the controversial issue of granting US troops immunity from prosecution under Iraqi law.
Mr Hammoud said the deal allowed US troops to remain immune from prosecution on military bases and while on operation.
All other cases would be considered by a joint judicial committee.
The draft deal still needs to be approved by the Iraqi Presidential Council, and critically, by the parliament.
The deal marks the end of 10 months of difficult negotiations.
Speaking on a visit to Baghdad on Thursday, US Secretary of State Condoleezza Rice said the final deal would be in line with Iraqi laws and sovereignty.
Ms Rice said the aim remained to hand over responsibility for security to Iraqi forces.
There are currently around 147,000 US troops in Iraq.