(CNN) -- John McCain's campaign said Friday that claims by a former State Department official that McCain had advocated unconditional dialogue with the Palestinian terrorist group Hamas were misleading.

Sen. John McCain's campaign says he has always placed conditions on talking with Hamas.

James P. Rubin said on CNN Friday that McCain had told him during a 2006 interview that the United States would inevitably have to deal with Hamas. Rubin said criticism now of similar statements by Democrats was "the ultimate flip-flop in American politics."

But McCain said Friday that his position had remained consistent, saying "I will not and would not sit down and negotiate with terrorist organizations and never have."

The presumed Republican presidential nominee said he would talk to Hamas only "if they wanted to become an organization dedicated to peace rather than the extermination of the state of Israel and sponsoring acts of terror."

The Arizona senator has criticized Barack Obama for his stated willingness to speak with hostile nations like Iran, and repeatedly raised what he has described as Hamas' approval of Obama's candidacy.

"Now, Sen. Obama supports sitting down with a state sponsor of that terrorist organization. Sen. Obama wants to have direct talks with the president of Iran, who has said that Israel is a stinking corpse and wants to wipe Israel off the map -- those are [the president's] words, not mine," McCain said.

Don't Miss

"I have some news for Sen. Obama. Talking, not even with soaring rhetoric ... in unconditional meetings with a man who calls Israel a 'stinking corpse' ... will not convince Iran to give up its nuclear program. It is reckless ... to suggest that unconditional meetings will advance our interests."

McCain added that "it would be a wonderful thing if we lived in a world where we don't have enemies. That's not the world we live in. And until Sen. Obama understands that reality, the American people have every reason to doubt whether he has strength, judgment and determination to keep us safe." Watch more of McCain's comments »

During an event in Watertown, South Dakota, Obama responded to McCain's attack, calling it a "kind of hypocrisy."

"John McCain has repeated this notion that I'm prepared to negotiate with terrorists. I have never said that; I have been adamant about not negotiating with Hamas, a terrorist organization that has vowed to destroy Israel and won't recognize them," the front-runner for the Democratic presidential nomination said.

"If George Bush and John McCain want to have a debate about protecting the United States of America, that is a debate that I'm happy to have any time, any place, and that is a debate that I will win, because George Bush and John McCain have a lot to answer for," Obama said.

"When he was in Davos [Switzerland] amongst the European crowd and I interviewed him there two years ago, he was talking as if it was appropriate and natural and reasonable to negotiate with Hamas, the new government of the Palestinian territories," Rubin said.

"And then two years later, he's taking a very, very different position ... smearing people for suggesting that one ought to talk to Hamas when it was he himself who was prepared to talk to Hamas two years ago."

Rubin wrote an op-ed piece in Friday's Washington Post relating an interview he conducted with McCain on the British network Sky News shortly after Hamas won the Palestinian elections in January 2006.

McCain said the United States would not be able to avoid a dialogue with the Islamic militant group.

"They're the government; sooner or later we are going to have to deal with them, one way or another," he said at the time. "And I understand why this administration and previous administrations had such antipathy towards Hamas, because of their dedication to violence and the things that they not only espouse but practice ...

"But it's a new reality in the Middle East. I think the lesson is people want security and a decent life and decent future, that they want democracy. Fatah was not giving them that."

Bounds sent reporters a 2006 McCain statement in which he called on Hamas to renounce violence -- though he did not say that requirement would be a precondition for dialogue.

"John McCain's position is clear and has always been clear: The president of the United States should not unconditionally meet with leaders of Iran, Hamas or Hezbollah," Bounds said.

In a January 2006 CNN interview, McCain stressed conditions Hamas would need to meet before establishing a working relationship of any kind with the United States.

McCain told CNN he hoped "that Hamas, now that they are going to govern, will be motivated to renounce this commitment to the extinction of the state of Israel. Then we can do business again. We can resume aid, we can resume the peace process."

On a conference call Thursday, McCain said Obama's position was "unacceptable" and shows that he "does not have the knowledge, the experience, the background to make the kind of judgments that are necessary to preserve this nation's security."

After President Bush seemed to suggest Thursday that Obama's foreign policy vision that included talking with adversaries was fatally flawed, Obama said again that his position had been mischaracterized. Watch the uproar over Bush's comments »

"George Bush knows that I have never supported engagement with terrorists, and the president's extraordinary politicization of foreign policy and the politics of fear do nothing to secure the American people or our stalwart ally Israel," the Illinois senator said in a statement.

He is planning to respond to attacks on his position at a speech Friday afternoon in South Dakota.