BAGHDAD, Iraq (CNN) -- Sen. Barack Obama and Iraqi Prime Minister Nuri al-Maliki on Monday discussed a "general time horizon" for any American troop withdrawals from Iraq, al-Maliki's office said.
Sen. Barack Obama rides in a helicopter Monday with Gen. David Petraeus in Baghdad, Iraq.
Obama -- who has made ending the Iraq war a cornerstone of his run for office -- engaged in what were described as productive talks with al-Maliki during a trip to Iraq.
The Iraqi government has been pushing for the United States to set a general timetable to spell out troop withdrawals.
Iraqi Vice President Tariq al-Hashimi also met with Obama Monday and told reporters afterward they discussed the security agreement.
"I told Sen. Obama (that) Iraqi and American negotiations regarding this are ongoing, and today new Iraqi-American negotiations on this agreement have started with Iraqi written proposals and have a timetable for the withdrawal of U.S. troops from Iraq," he said.
The Bush administration has opposed timetables for troop withdrawals. But al-Maliki and President Bush last week agreed to a "general time horizon for meeting aspirational goals" on troop cuts.
The prime minister reiterated that principle with Obama, according to a statement from al-Maliki's office.
"Developments of the situation and the circumstances is what will decide the presence of foreign troops in Iraq, but without keeping open-ended dates," al-Maliki said, according to a statement from his office.
"With the developments on the ground, we can set a vision and clear horizons regarding this issue, and this is a view both sides agree on in the ongoing negotiations."
Al-Maliki's office quoted Obama as saying he is "supportive and committed to preserving the gains achieved by the Iraqi government" under al-Maliki's leadership and that he admires the prime minister's courage.
Obama has proposed withdrawing U.S. combat troops from Iraq within 16 months of taking office. Spokesman Ali al-Dabbagh said the Iraqi government's "vision" is that most U.S. combat troops would be out of Iraq by 2010. Asked if that stance is part of the current negotiations, al-Dabbagh said, "No. This is the Iraqi vision." iReport.com: Tell us the most important thing the next president needs to know about Iraq
A German magazine on Saturday quoted al-Maliki as saying he backed Obama's proposal, but al-Dabbagh has said that his remarks "were misunderstood, mistranslated and not conveyed accurately."
In a statement Sunday, the magazine, Der Spiegel, said it "stands by its version of this interview."
In the magazine interview, al-Maliki did not indicate that he was endorsing Obama over Sen. John McCain, the presumptive Republican nominee.
McCain does not think American troops should return to the United States until Iraqi forces are capable of maintaining a safe, democratic state. He has been a strong advocate of the "surge" -- the 2007 escalation of U.S. troops -- and has said troops should stay in Iraq as long as needed.
Louisiana Gov. Bobby Jindal -- who's been mentioned as a possible vice presidential pick for McCain -- on Monday criticized Obama's push to remove troops in 16 months as an "arbitrary timetable based on politics versus a plan based on the actual results on the ground."
"One of the reasons I'm supporting [McCain] -- he has made it clear he would rather lose an election than lose a war. He's made it very clear -- let's listen to the commanders on the ground," Jindal said on CNN's "American Morning."
McCain last week chided Obama for laying out his plans for Iraq and Afghanistan before talking to Gen. David Petraeus, the head of U.S. troops in Iraq.
Obama met with Petraeus and Ryan Crocker, the U.S. ambassador to Iraq, in Baghdad on Monday.
He also met with Tariq al-Hashimi, a Sunni Arab who is one of Iraq's two vice presidents; Lt. Gen. Lloyd Austin, commander of Multi-National Corps-Iraq; British Maj. Gen. Barney White Spunner, commander of Multi-National Division South East; and Maj. General Abdul Aziz, the Iraqi army's 14th Division commander.
Obama's stop in Iraq marks his second visit to the country. The presumptive Democratic presidential nominee's trip abroad began in Kuwait and Afghanistan and will go on to Jordan, Israel, the West Bank, Germany, France and Britain. The senator from Illinois first visited Iraq in 2006. See the stops on Obama's trip »
Obama arrived Monday afternoon in the southern city of Basra, according to U.S. Embassy spokesman Armand Cucciniello.
Obama is traveling with Sen. Jack Reed of Rhode Island, a leading Democrat on the Senate Armed Services Committee, and Sen. Chuck Hagel, a Nebraska Republican who serves on the Foreign Relations Committee and is an outspoken critic of the Iraq war.
Obama has said that if he's elected, he would commit more troops to Afghanistan and would order the military to end the war in Iraq, which he has called a "dangerous distraction" from the Afghan battle.
Obama spent Saturday and Sunday in Afghanistan, where he met with U.S. troops at three bases and with Afghan President Hamid Karzai -- a leader the Democratic senator has criticized for doing too little to rebuild the war-torn nation. Watch Obama meet Karzai, U.S. soldiers in Afghanistan »
The fight in Afghanistan recently has become a more pressing issue on the political radar. More coalition forces have died in Afghanistan than in Iraq in May, June and so far in July.
Last week, in a major address laying out his foreign policy position, Obama said, "As should have been apparent to President Bush and Sen. McCain, the central front in the war on terror is not Iraq, and it never was."
He said part of his strategy would be "taking the fight to al Qaeda in Afghanistan and Pakistan."
CNN's Jomana Karadsheh, Frederik Pleitgen and Mohammed Tawfeeq contributed to this report.