Security was tightened up in Baghdad for the visit
US Democratic presidential hopeful Barack Obama has met the Iraqi prime minister on his first visit to Baghdad as part of a major foreign tour.
Mr Obama has advocated pulling out US combat troops within 16 months if elected president in November.
Earlier, in Kabul, Mr Obama said the battle against terrorism had to focus on the situation in Afghanistan.
However, US commanders, and some members of the Iraqi government, are opposed to setting any timetables.
Mr Obama held talks with Prime Minister Nouri Maliki shortly after arriving as part of a US Congressional delegation.
The pair met in Baghdad's heavily-protected Green Zone, the seat of the Iraqi government.
The Illinois senator said he "had a very constructive discussion" with the Iraqi prime minister.
Senator Obama wants the US to hand over responsibility for security to Iraq.
Senator Obama also met President Jalal Talabani as well as the top US military commander in Iraq, Gen David Petraeus.
While advocating the withdrawal of combat troops, Mr Obama says he is prepared to be flexible on details, and could leave some troops behind for special tasks, such as training Iraqi forces and tackling remnants of the al-Qaeda in Iraq group.
But he did not speak with Prime Minister Maliki about the issue, according to an Iraqi government spokesman, Ali al-Dabbagh.
"This issue, we do not discuss," said Mr Dabbagh, "Obama did not speak about anything which concerns the Iraqi government because he does not have any official (government) capacity," he said.
Senator Obama is visiting a series of countries over the next week in an attempt to bolster his foreign policy and security credentials.
He is also due to visit Jordan, Israel, Germany, France and the UK.
Travelling with Mr Obama are two Senate colleagues, Jack Reed and Chuck Hagel, who are long-time critics of the US military's involvement in Iraq.
Mr Obama wants Iraq to assume principal responsibility for security, according to one of his senior foreign policy advisors, Susan Rice.
"We cannot sustain the current high levels of deployment in Iraq indefinitely... without breaking our military," she told the BBC.
"Nor can we maintain them at high levels in permanent bases with the agreement of the Iraqi government because they've been quite clear that they don't want that."
On Sunday, the Iraqi government denied that Mr Maliki had told a German magazine that he backed Mr Obama's plan to withdraw combat troops within 16 months, saying his remarks had been misunderstood.
Last week, Mr Maliki and US President George W Bush said they had agreed to set a "time horizon" for the withdrawal as part of a security pact still being negotiated.
Mr Obama came to Iraq after a brief visit to neighbouring Kuwait
Any decision to remove troops would be based on "improving conditions", not an "arbitrary date", the White House said.
The BBC's Jim Muir, in Baghdad, says the leaders of Iraq's governing coalition are under pressure to show movement towards sovereignty.
They risk being outflanked in forthcoming provincial elections by more militant elements calling for an immediate withdrawal of foreign forces, such as the group led by the radical Shia cleric, Moqtada Sadr, our correspondent says.
Violence in Iraq is at its lowest level since 2004, although frequent attacks continue throughout the country. Some 50 people died in two separate twin suicide bombings last week.
Speaking before his visit, Mr Obama said some of the troops withdrawn from Iraq ought to be sent to Afghanistan to reinforce efforts there against a resurgent Taleban and to control spiralling violence.
TRUSTED ON MIDDLE EAST
Americans with more trust in one candidate than the other to handle the situation involving -
Iraq: McCain 47%, Obama 45%
Iran: McCain 46%, Obama 44%
Israel and the Palestinians: McCain 44%, Obama 42%
Source: Washington Post/ABC News, 10-13 July
"We have to understand that the situation is precarious and urgent and I believe this has to be the central focus, the central front, in the battle against terrorism," he told the CBS programme, Face the Nation.
He said the US needed to start planning immediately to send in more troops and called for an extra one to two brigades in Afghanistan.
Mr Obama's Republican presidential rival, John McCain, has criticised him for announcing a strategy before visiting the region and for setting a date for a US withdrawal from Iraq.
Mr McCain's foreign policy adviser, Randy Scheunemann, said Mr Obama was "stubbornly adhering to an unconditional withdrawal that places politics above the advice of our military commanders".