BAGHDAD, Iraq (CNN) -- Iraq's main political parties Sunday reached a deal designed to allow non-U.S. foreign troops to stay in the country past the end of the year, when a United Nations resolution authorizing their presence expires.



Iraqi and British soldiers during an Iraqi army training session in Basra last week.



The deal would set a deadline of July 31, 2009, for all non-U.S. foreign troops to withdraw, according to Abdul Hadi al-Hassani, a lawmaker with the main Shiite parliamentary bloc, who spoke to Iraqi state television on Sunday.



The agreement awaits approval by Iraq's Parliament, which is expected to vote on the measure on Monday, several Iraqi lawmakers said.



The emergency negotiations came after lawmakers Saturday rejected a similar proposal that would have been law. Sunday's proposal, by contrast, was drafted as a resolution that would empower the Cabinet to authorize international troop presence without requiring Parliament to pass a law.



Washington and Baghdad have already worked out a separate agreement that will keep U.S. troops in Iraq but tighten restrictions on them.



Countries other than the United States that have troops in Iraq could be left with no legal cover for their presence there if Baghdad does not act swiftly.



Iraq's Cabinet had approved a draft law authorizing non-U.S. foreign troops Tuesday, the first step in passing legislation, but it fell at the next hurdle -- Parliament. That left lawmakers scrambling Sunday for a way to give foreign troops legal cover quickly.



Lawmakers expect Sunday's agreement to cut through the problem, because a resolution can be passed in a single day, while it takes at least a week to pass a law.



British government lawyers, meanwhile, are studying "all possible options" to legally extend the presence of British troops in Iraq beyond New Year's Day in case Iraq's Parliament rejects the new compromise.



Britain has the second-largest contingent of foreign troops in Iraq -- about 4,100 -- after the United States, which has about 142,500. All other countries combined have only several hundred troops in the country.



Britain and Iraq announced last week that British troops would begin leaving Iraq in May 2009, while a "handful" of British military personnel would remain after that date to continue naval training for Iraqi sailors, primarily to protect oil platforms.



The United States reached a security agreement with Iraq in November. That deal, which was ratified by the Iraqi Parliament, calls for American troops to leave Iraqi cities by June 2009, and to be out of Iraq by the end of 2011.



Beginning New Year's Day, U.S. commanders will have to get prior Iraqi government approval for any operations. American military personnel who commit crimes while not on duty or who commit grave crimes while on duty would be subject to Iraqi legal jurisdiction under the new agreement.



The U.S. security agreement does not govern the presence of troops from other coalition countries.



The Parliament's rejection of the Cabinet's proposed law allowing foreign forces to remain in Iraq after January 1 came after heated arguments that lasted for days. The session became so contentious that Parliament's speaker threatened to resign, lawmakers said.



Some political blocs, notably the Sadrists, oppose any extension of the presence of foreign troops in Iraq. That group, headed by Shiite leader Muqtada al-Sadr -- an anti-Western cleric -- is demanding an immediate withdrawal of foreign forces.



CNN's Jill Dougherty and Jomana Karadsheh contributed to this report.
What would the deadline be for withdrawal? who will examine options? What would deal permit? Who opposed the extension? who  would permit non-U.S. troops to stay? who will oppose any extension of the presence of foreign troops in Iraq? What is Iraqi parliament's deal?
July 31, 2009, British government lawyers, foreign troops to stay in the country past the end of the year, Sadrists, Iraq's main political parties Some political blocs, notably the Sadrists, allow non-U.S.
question: What would the deadline be for withdrawal?, answer: July 31, 2009, | question: who will examine options?, answer: British government lawyers, | question: What would deal permit?, answer: foreign troops to stay in the country past the end of the year, | question: Who opposed the extension?, answer: Sadrists, | question: who  would permit non-U.S. troops to stay?, answer: Iraq's main political parties | question: who will oppose any extension of the presence of foreign troops in Iraq?, answer: Some political blocs, notably the Sadrists, | question: What is Iraqi parliament's deal?, answer: allow non-U.S.