The Iraqi government boosted Barack Obama's election chances today by publicly backing during his visit to Baghdad his timetable for withdrawal of all US combat troops by 2010.

The main Iraqi government spokesman, Ali al-Dabbagh, speaking after Obama met the Iraqi prime minister, Nouri al-Maliki, told reporters: "We cannot give any timetables or dates but the Iraqi government believes the end of 2010 is the appropriate time for the withdrawal of forces."

He added a caveat that if violence, which the US and Iraqi governments say has fallen by 85% over compared with this time last year, was to worsen then the Iraqis will rethink their plan.

Obama, who described talks with Maliki as "very constructive," is proposing that all US combat troops be out of Iraq by April 2010. There are 156,000 US troops in Iraq and Kuwait at present but only about a third are combat troops and Obama has avoided putting a figure on how many of the other troops will be left in Iraq.

The Democratic presidential candidate, on his first visit to Iraq since January 2006, flew into Basra from Kuwait this morning before continuing to Baghdad to meet Maliki and the US commander, general David Petraeus, and the US ambassador, Ryan Crocker.

Dabbagh said that Obama, who is part of a congressional delegation along with fellow senators Chuck Hagel and Jack Reed, did not raise his withdrawal plans with Maliki. "This issue, we do not discuss ... Obama did not speak about anything which concerns the Iraqi government because he does not have any official capacity," Dabbagh said.

The Iraqi government insisted it is not endorsing Obama over his Republican rival John McCain and that it was coincidental that Obama's timetable is within the timescale envisaged by the Iraqis.

Obama's visit comes after repeated taunts by McCain over his failure to visit Iraq in the last two years. McCain told NBC today that the reduction in violence vindicated his push last year for an increase in US troop levels, a move that Obama opposed at the time. "I hope he will have a chance to admit that he badly misjudged the situation and he was wrong," McCain said.

McCain's spokeswoman, Nancy Pfotenhauer, denied that the Iraqi government's support for a 2010 timetable undermined him.

"We should be able to draw down troops as soon as conditions on the ground make that the right thing to do," she said, noting that McCain had said last month he envisaged troops being withdrawn by 2013.

She added that McCain would make the decision based not on what suits his election campaign but on the advice of US commanders on the ground told him at the time.

The comment by Dabbagh comes less than 24 hours after he had claimed that Maliki had been misquoted when he made similar remarks about timing in an interview with the German magazine Der Spiegel. The denial followed a call from the US embassy in Baghdad seeking clarification.

But Der Spiegel released a tape of the interview that supported its version.

Maliki is under pressure from other parts of his government coalition to press for an early departure of US troops against a backdrop of the reduction in violence, improved performances by Iraqi troops and high oil revenues.

President George Bush has marginally shifted his position on troop withdrawals over the last few days. Having repeatedly refused to countenance a timetable, the White House said he was now in discussion with Maliki about setting a "general time horizon".

The US and Iraq have been in discussion about troop withdrawals as part of a new US-Iraq pact. The White House disclosed today that it was unlikely to the two sides will meet a July 31 deadline for completion of negotiations, though the White House spokeswoman, Dana Perino, suggested the delay might be a matter only of days.

Obama has made contradictory and confusing remarks, too, recently about timetable. He appeared to back away on July 3 from his timetable of a complete withdrawal of combat troops within 16 months of being sworn in as president in January next year and hinted instead that withdrawal would depend on events on the ground. But, faced with a backlash among Democratic activists, he hastily called a press conference to insist he was sticking to the original timetable.

Obama was met at Baghdad airport by Petraeus, who accompanied him on a helicopter ride into the heavily fortified Green Zone.

He spent two hours in Basra, where British troops are based, and met US, British and Iraqi officials. There are about 4,000 British troops still in Basra, holed up at the airport, and about 1,000 US troops.

Obama, who was in Afghanistan on Saturday and yesterday at the start of a crowded overseas visit, is scheduled to have dinner tonight with King Abdullah of Jordan before travelling to Israel tomorrow for the next leg of his tour.