"With the authority of the government of Iraq given to the defense minister, an agreement was signed with Britain today which will be implemented from the start of the new year until June 30," defense ministry spokesman Major General Mohammed al-Askari said.
"A little while ago an agreement was also signed regarding the withdrawal of the Australian forces in Iraq. It was signed between the Iraqi defense minister and the Australian ambassador," Maj Gen Askari said.
The long-awaited agreements come just a day ahead of the expiry of the UN mandate, effectively legalizing the presence of non-US foreign troops in the country at the eleventh hour and moving Iraq closer to full sovereignty.
Under the agreement, Britain, which has about 4,100 troops based at Basra airport in southern Iraq, will play only a supportive role in their area.
"British troops will only support, consolidate and develop the Iraqi security forces without having any combat mission. July 31 will be the last day for the withdrawal of the British forces from Iraq," Maj Gen Askari said.
Iraqi defense minister Abdel Qader Mohammed Jassem Obeidi signed the separate accords with British ambassador Christopher Prentice and Australian ambassador Robert Tyson.
After British troops leave next year, relations between London and Baghdad will in theory revert to those between any other countries.
British troop numbers in the Iraq campaign peaked at 46,000 in March and April 2003 for the invasion.
The end of the UN mandate put in place soon after the March 2003 US-led invasion means Iraq may be able to take greater control of its own security although foreign forces will remain in the country under separate bilateral agreements.
However, deals will also need to be signed by Iraq with Estonia, Romania, El Salvador and NATO, each of whom have small numbers of troops stationed in Iraq.
The United States, which has 146,000 soldiers in Iraq, in November signed an agreement with Baghdad which allows its combat forces to remain in the country until the end of 2011.
Under the terms the agreement signed with Washington, the United States will hand over on January 1 Saddam Hussein's former official residence to the Iraqi government after occupying the majestic sandstone palace since 2003.
The vast palace, at the very heart of the heavily fortified Green Zone where the Iraqi government and some major western countries' embassies are located, is seen by Iraqis as a symbol of the US occupation.
Iraq's government spokesman Ali al-Dabbagh also said on Tuesday that the Iraqi defense ministry will be put in charge of identifying the exact responsibilities of each foreign military mission.
"Their missions will be restricted to training operations, sea surveillance, treating explosives and bombs, and the Iraqi ministry of defense is going to take care of coordinating joint operations with these troops," Dabbagh said in a statement.