McCain said Obama placed his political self-interest ahead of his country's, a theme the Arizona Republican has often repeated. McCain told a friendly convention of the Veterans of Foreign Wars that Obama's positions have changed as his political ambitions grew.
"With less than three months to go before the election, a lot of people are still trying to square Sen. Obama's varying positions on the surge in Iraq. First, he opposed the surge and confidently predicted that it would fail. Then he tried to prevent funding for the troops who carried out the surge," McCain said.
"Not content to merely predict failure in Iraq, my opponent tried to legislate failure."
Obama has acknowledged the surge reduced violence in Iraq but says it has failed in its political goal of facilitating a reconciliation among contentious Iraqi factions. The Illinois Democrat proposes to withdrawn U.S. combat forces from Iraq within 16 months; McCain opposes any timetable for withdrawal.
Iraqi leaders have been pressing the U.S. for a timetable for withdrawal.
"It is hard to understand how Sen. McCain can at once proclaim his support for the sovereign government of Iraq, and then stubbornly defy their expressed support for a timeline to remove our combat brigades from their country," said Obama campaign spokesman Bill Burton. "John McCain is intent on spending $10 billion a month on an open-ended war, while Barack Obama thinks we should bring this war to a responsible end and invest in our pressing needs here at home."
McCain said victory in Iraq is in sight, but much depends on the next president's judgment.
"The lasting advantage of a peaceful and democratic ally in the heart of the Middle East could still be squandered by hasty withdrawal and arbitrary timelines. And this is one of many problems in the shifting positions of my opponent, Sen. Obama," McCain said.
The Republican nominee-in-waiting said Obama's political ambitions have blinded him to reality. He also said Obama has refused to change his positions to reflect new success.
"Even in retrospect, he would choose the path of retreat and failure for America over the path of success and victory," McCain said. "In short, both candidates in this election pledge to end this war and bring our troops home.
"The great difference is that I intend to win it first."
Obama was scheduled to speak to the group on Tuesday. President Bush plans to attend on Wednesday.