Mr. Romney’s problem is that he does not actually have any real ideas on foreign policy beyond what President Obama has already done, or plans to do. He supports the planned withdrawal from Afghanistan — and was quick to insist on Monday night that he would pull out by 2014. He thinks there should be economic sanctions on Iran, and he thinks the United States should be encouraging Syrian opposition forces that seem moderate. Mr. Romney said he would work with Saudi Arabia and Qatar on this, but those governments are funneling arms to the jihadist groups that he says he abhors.

The president kept up the attack at virtually every opportunity, showing no sign of the oddly disconnected Barack Obama who lost the first debate. When Mr. Romney called for spending more money on the military than the United States can afford or the military wants, Mr. Obama moved in: “You mentioned the Navy, for example, and that we have fewer ships than we did in 1916. Well, Governor, we also have fewer horses and bayonets.” Mr. Romney tried to revive the Republican claim that Mr. Obama conducted an “apology tour” at the start of his presidency, which Mr. Obama correctly called “the biggest whopper” of a campaign that has been filled with them. And he took a dig at Mr. Romney’s recent world travels. “When I went to Israel as a candidate,” he said, “I didn’t take donors, I didn’t attend fund-raisers.”

Mr. Romney tried to say that the president had “wasted” the last four years in trying to stop Iran’s nuclear weapons program. But Mr. Obama said, “We’ve been able to mobilize the world. When I came into office, the world was divided. Iran was resurgent. Iran is at its weakest point, economically, strategically, militarily.”

Mr. Romney tried to set himself apart from Mr. Obama on Iran, but ended up sounding particularly incoherent. At one point he said he would indict President Mahmoud Ahmadinejad on genocide charges. He gave no clue how he would do that; like many of his comments, it was merely a sound bite.

Mr. Obama hit Mr. Romney hard on his ever-shifting positions on world affairs, including comments he made in 2008 disparaging the idea that killing Osama bin Laden should be a priority. “You said we should ask Pakistan for permission,” Mr. Obama said. “If we had asked Pakistan for permission, we would not have gotten it.”