(CNN) -- As Sen. Barack Obama makes his headline-grabbing trip overseas, Sen. John McCain argued Tuesday that he's best equipped to make the tough calls at home and abroad.
Sen. John McCain is criticizing Sen. Barack Obama for his opposition last year to the "surge" in Iraq.
McCain slammed Obama's position on Iraq during a town hall meeting in Rochester, New Hampshire.
"I had the courage and the judgment to say that I would rather lose a political campaign than lose a war. It seems to me that Sen. Obama would rather lose a war in order to win a political campaign," McCain said.
The presumptive Republican presidential nominee also argued that Obama is supporting withdrawal and defeat.
"You might recall that Sen. Obama, my opponent, said the surge would not succeed, that he wanted us out," McCain said, referring to the 30,000 additional troops sent to Iraq in 2007 as part of a campaign to secure Baghdad and its surrounding provinces. Watch McCain say Obama wants to "lose war to win political campaign" »
"If he had his way ... we would have had defeat. And my friends that would have been a catastrophe for the United States of America. He was wrong then, he's wrong now and he still failed to acknowledge ... that the surge succeeded."
McCain said the same strategy that worked in Iraq will succeed in Afghanistan as well.
McCain's campaign is doing what it can to keep Obama from using the overseas trip to burnish his foreign policy credentials.
As Obama and Iraqi Prime Minister Nuri al-Maliki discussed a general time frame for troop withdrawal on Monday, McCain was quick to point to the surge as the reason for progress on the ground.
"When you win wars, troops come home -- and we are winning. And the fact is that if we had done what Sen. Obama wanted to do, we would have lost, and we would have faced a wider war," McCain said Monday as he campaigned in Kennebunkport, Maine, with former President George H.W. Bush. Watch McCain criticize Obama's trip »
McCain aides are trying to protect one of the few areas where the GOP candidate does better in polls than Obama -- the ability to be commander in chief.
According to an ABC News/The Washington Post poll, 72 percent think McCain would be a good commander in chief, while less than half -- 48 percent -- say Obama would.
The poll, conducted July 10-13, surveyed 1,119 people and has a margin of error of plus or minus 3 percentage points.
McCain and Obama have different views on how to handle the situation in Iraq. McCain says troop withdrawal should be based on conditions on the ground, while Obama advocates removing all combat brigades within 16 months of taking office.
Americans are split between the two positions, according to the poll.
Al-Maliki appeared to back the idea of a timetable in an interview with the German magazine Der Spiegel over the weekend, but an Iraqi government spokesman said later the prime minister's comments were "misunderstood, mistranslated and not conveyed accurately." (The magazine has said it "stands by its version of this interview.")
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.
McCain shrugged off the suggestion that Obama's talks with al-Maliki undercut his message.
"It doesn't in the slightest undercut the fact that it's based on the conditions on the ground," he said.
McCain pointed to comments made by Adm. Mike Mullen, chairman of the Joint Chiefs of Staff, who said Sunday that the consequences of Obama's withdrawal plan could be "dangerous."
"I hope [Obama] will pay attention to the chairman of the Joint Chiefs of Staff, particularly someone who has no military experience whatsoever," McCain said.
Obama has said it's wrong to think he should change his commitment to end the war based on the gains of the surge.
"This argument misconstrues what is necessary to succeed in Iraq, and stubbornly ignores the facts of the broader strategic picture that we face," Obama said last week.
Obama has called the war in Iraq a "dangerous distraction" and says more emphasis must be placed on the battle in Afghanistan.
CNN political producer Ed Hornick contributed to this report.