Image caption Robert Gates met US troops in Baghdad.

US troops could if required by Iraq stay in the country beyond the agreed withdrawal date of 31 December, 2011, the US defence secretary has said.

Robert Gates, who is visiting Iraq, says an extended military presence is an option.

"If folks here are going to want us to have a presence, we're going to need to get on with it pretty quickly in terms of our planning," he said.

A large number of the 50,000 US troops in Iraq are due to leave in the summer.

'Wait and see'

Mr Gates, who arrived in Baghdad on an unannounced visit on Wednesday, met the commander of US military forces in Iraq, Lt Gen Lloyd Austin, before holding talks with Iraqi leaders.

"I think there is interest in having a continuing presence, but the politics are such that we'll just have to wait and see because the initiative ultimately has to come from the Iraqis," Mr Gates said during a question-and-answer session with some of the 200 soldiers stationed at the Camp Liberty US base.

The US has formally ended combat operations in Iraq but the country still faces problems dealing with violence and insurgency.

I think there is interest in having a continuing presence, but the politics are such that we'll just have to wait and see because the initiative ultimately has to come from the Iraqis. Robert Gates, US Defence Secretary

At the peak of the conflict there were around 170,000 American troops serving in the country.

Mr Gates said Iraq had made "extraordinary" progress, setting an example for democracy in the region, but he said more work needed to be done to ensure the Iraqi Security Forces (ISF) were in the right place by the end of 2011.

The country is still lacking important security capabilities, including the ability to maintain its own forces, said Gen Austin.

In February Mr Gates told a congressional committee that Iraq would face problems after the withdrawal, predicting that Iraqis would struggle to protect their own airspace, and would "have problems with logistics and maintenance".

Any decision to keep troops in Iraq past 2011 would need to be made quickly, said Mr Gates, because American forces were already under pressure around the world, including in Japan where 19 US Navy ships and 18,000 military personnel are helping in the aftermath of the earthquakes and tsunami.