Iraq signed agreements with Britain and Australia on Tuesday for their troops to stay in Iraq for seven months after a U.N. mandate authorizing their presence expires on Jan. 1, Iraq's Defense Ministry 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," Askari said.

The long-awaited agreements come just a day ahead of the expiry of the U.N. mandate, effectively legalizing the presence of non-US foreign troops in the country at the eleventh hour and moving Iraq closer to full sovereignty.

Britain has 4,100 troops stationed in Iraq, near the southern oil centre of Basra. Australia has 300 troops.

Under the agreement, Britain 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," Askari said.

"I can confirm that we've signed an agreement which gives us all the necessary legal cover that we needed to complete our tasks here," a spokesman for the British embassy in Baghdad told Reuters.

An Australian embassy official was not able to comment.

Iraq's Presidency Council on Sunday ratified a measure agreed by parliament allowing troops from Britain, Australia, El Salvador, Romania and Estonia and the NATO alliance to stay in Iraq until July 2009.

Bilateral agreements between Iraq and each country still needed to be finalized.

Britain, which sent 46,000 troops to the Gulf as the main U.S. ally in the 2003 invasion, intends to keep about 400 advisers and trainers in the country after the July deadline.

Askari said deals would be signed in the next few days with diplomats from other countries with small numbers of troops in the U.S.-led force in Iraq.