Mr. Obama fired back later in the day, accusing his opponent of politicizing a national tragedy. “Governor Romney seems to have a tendency to shoot first and aim later,” he told CBS News for its “60 Minutes” program. “And as president, one of the things I’ve learned is you can’t do that — that, you know, it’s important for you to make sure that the statements that you make are backed up by the facts, and that you’ve thought through the ramifications.”

The harsh exchanges had their origins on Tuesday night as Mr. Romney’s team was following the increasingly volatile developments in the Middle East. The embassy statement, issued hours before protests in Cairo and the attack in Libya began, had tried to mollify Muslims upset at an American-made anti-Islam video. “We firmly reject the actions by those who abuse the universal right of free speech to hurt the religious beliefs of others,” the statement said.

For Mr. Romney, whose 2010 book, “No Apology,” assailed Mr. Obama for what he saw as trying to placate America’s enemies, the embassy statement rankled. When aides showed it to him, they said he reacted strongly to the notion of “hurt” religious feelings. In his mind, they said, the Obama administration was aligning itself with those who would do harm to the United States. Already on the defensive for not mentioning Afghanistan in his convention speech and losing some ground in recent polls, Mr. Romney saw an opportunity to draw a stark contrast.

While Mr. Romney was on a four-hour flight from Reno, Nev., to Jacksonville, Fla., his senior staff — a mix of the policy shop, the communications team, and the strategy operation — crafted a statement on a conference call. Among those participating were Lanhee Chen, the policy director; Richard Williamson, a foreign policy adviser; and Stuart Stevens, the campaign strategist.

As soon as Mr. Romney landed, he was updated on breaking developments. He personally read and approved his campaign’s statement before it was sent out at 10:10 p.m. Tuesday. “It’s disgraceful that the Obama administration’s first response was not to condemn attacks on our diplomatic missions, but to sympathize with those who waged the attacks,” it said.