BAGHDAD  The Iraqi government on Monday left little doubt that it favors a withdrawal plan for American combat troops similar to what Senator Barack Obama has proposed, providing Mr. Obama with a potentially powerful political boost on a day he spent in Iraq working to fortify his credibility as a wartime leader.

After a day spent meeting Iraqi leaders and American military commanders, Mr. Obama seemed to have navigated one of the riskiest parts of a weeklong international trip without a noticeable hitch and to have gained a new opportunity to blunt attacks on his national security credentials by his Republican rival in the presidential race, Senator John McCain.

Whether by chance or by design, the government of Prime Minister Nuri Kamal al-Maliki of Iraq chose a day when Mr. Obama was in the country to provide its clearest statement yet about its views on the withdrawal of American troops. After a weekend of dispute about precisely what Mr. Maliki was suggesting, his spokesman, Ali al-Dabbagh, told reporters in Baghdad, “We cannot give any timetables or dates, but the Iraqi government believes the end of 2010 is the appropriate time for the withdrawal.”

Mr. Obama has said he would seek to withdraw American combat forces over 16 months if he is elected president, starting upon taking office in January, meaning his plan would be completed on roughly the same timetable as suggested by the Iraqis. The Bush administration has signaled a willingness to work with the Iraqis on their desire to begin setting at least a general “time horizon” for reducing the American military presence, leaving Mr. McCain at risk of becoming isolated in his position of firm opposition to a withdrawal timetable.