(CNN) -- Sen. Barack Obama says he may travel to Iraq between winning the Democratic nomination and the November general election.
Sen. Barack Obama is considering a trip to Iraq. It would be his first in more than two years.
The Illinois Democrat told reporters that "Iraq would obviously be at the top of the list of stops."
"I think that if I'm going to Iraq, then I'm there to talk to troops and talk to commanders. I'm not there to try to score political points or perform," Obama said Wednesday. "The work they're doing there is too important."
Obama said he was considering visiting Iraq after Sen. John McCain had suggested that the two should make a joint trip to the country, a proposal Obama dismissed Tuesday as "nothing more than a political stunt."
McCain said Wednesday night that he is happy his likely general election opponent is considering a trip and that he believes that Obama would change his views on Iraq after spending some time there.
"It's long overdue," McCain said at a fundraiser in Beverly Hills, California. "It's been 871 days since he was there, and I'm confident that when he goes, he will then change his position on the conflict in Iraq, because he will see the success that has been achieved on the ground."
McCain, the presumptive Republican nominee, and his fellow Republicans have strongly criticized Obama for not visiting Iraq since January 2006. The Republican National Committee has a running count of the days since his last trip to the country on its Web site. Watch how McCain is going after Obama »
"Sen. Obama has been to Iraq once -- a little over two years ago he went -- and he has never seized the opportunity except in a hearing to meet with Gen. Petraeus," McCain said at a campaign event in Reno, Nevada. "My friends, this is about leadership and learning.
"He wants to sit down with the president of Iran but hasn't yet sat down with Gen. Petraeus, the leader of our troops in Iraq?" McCain asked.
Gen. David Petraeus is the top U.S. commander in Iraq and will soon be promoted to the U.S. Central Command, which is responsible for the Middle East.
McCain has criticized Obama for expressing a willingness to engage Iranian President Mahmoud Ahmadinejad in diplomatic negotiations.
The Arizona Republican said Obama's rejection of his proposal for a joint trip showed "a fundamental misunderstanding of the gravity of this issue." Watch McCain say he will 'never surrender' in Iraq »
But Bill Burton, Obama's spokesman, said "it seems odd that Sen. McCain, who bought the flawed rationale for war so readily, would be lecturing others on their depth of understanding about Iraq."
Burton also said a joint trip by the two candidates would not provide a "real debate" about the Iraq war.
"The American people don't want any more false promises of progress; they deserve a real debate about a war that has overstretched our military and cost us thousands of lives and hundreds of billions of dollars without making us safer," he said.
CNN's Candy Crowley, Alexander Marquardt and Alexander Mooney contributed to this report.
All About John McCain • Barack Obama • Iraq War