By Paul Reynolds
World affairs correspondent, BBC News website
Senator John McCain: On the attack
Foreign policy has already entered the arena in the US presidential election - and it is getting nasty.
It is the shape of things to come.
The McCain camp is trying to portray the likely Democratic candidate Barack Obama as soft on terrorism, as "Hamas's favourite" and as a man who would not defend America's security.
The Hamas tag followed a comment by a Hamas spokesman Ahmed Yousef who told WABC Radio: "We like Mr Obama. We hope he will [win] the election and I do believe he is like John Kennedy, great man with great principle."
The McCain campaign circulated this comment: "We need change in America, but not the kind of change that wins kind words from Hamas, surrenders in Iraq and will hold unconditional talks with Iranian President Ahmadinejad."
In one sentence, John McCain linked three American foreign policy fears - Hamas, Iraq and Iran - and tried to isolate Mr Obama as unreliable on all three.
President Ahmadinejad of Iran is likely to play a prominent role in the McCain rhetoric.
It is a potent attack and Senator Obama has to see it off if he is to survive.
In contrast, John McCain is projected by his own side as the strong, independent figure who would stand up to terrorists. He is even promising victory in Iraq by 2013. That date marks the end of the next presidential term.
"By January 2013… the Iraq war has been won," Senator McCain declared recently in a speech outlining his presidential ambitions.
Promising victory in Iraq has a strong appeal to the voters. Promising withdrawal might be seen as offering them defeat.
It undermines one of Barack Obama's most heavily-stressed points - his opposition to the war. This has lost much of its resonance with the success so far, even if in relative terms, of the reinforcement of US troops in Iraq
John McCain came out in favour of the surge early on, at a time when others were calling for a withdrawal timetable. Now he is reaping the rewards of that approach.
It is ironic that the Iraq war, once such a weak spot for Republicans, should have turned out to be such a strong card for John McCain.
Another flanking attack has come from President Bush himself. In a speech in Jerusalem, he used the "a" word - appeasement - in criticising those who wanted to "negotiate with the terrorists and radicals".
"As Nazi tanks crossed into Poland in 1939, an American senator declared: 'Lord, if I could only have talked to Hitler, all this might have been avoided.' We have an obligation to call this what it is - the false comfort of appeasement," President Bush said.
Senator Barack Obama: Counter-attacking
Later, the White House stated that Mr Bush's target was former President Jimmy Carter, who had met Hamas leaders.
But Barack Obama took it as a comment on himself.
"If George Bush and John McCain want to have a debate about protecting the United States of America, that is a debate I am happy to have any time, any place," he stated.
And he has found a weak link in the McCain chain.
The former State Department spokesman under President Clinton, James Rubin, who hosted an interview programme on Sky TV when he lived in London, revealed what John McCain had said about Hamas after it won the Palestinian elections in 2006:
"They're the government; sooner or later we are going to have to deal with them, one way or another... it's a new reality in the Middle East," said the senator.
John McCain responded by saying that he was quoted out of context and that he would not talk to Hamas before it recognised the state of Israel, one of the international conditions for its diplomatic acceptance.
To this Mr Obama added: "He was actually guilty of the exact same thing that he is accusing me of, and in fact was saying maybe we need to deal with Hamas. That's the kind of hypocrisy we've been seeing in our foreign policy."
Senator Obama has also said that engagement with Hamas can come only when it accepts the international conditions for its recognition.
Mr Obama's wider counter-attack is to link John McCain with the policies of the Bush administration, implying that McCain would represent a third Bush term.
He accused the White House of making "bombastic exaggerations" and of encouraging "fear-mongering".
"The American people are going to look at the evidence. We don't get a sense that this has been a wise foreign policy or a smart foreign policy or a tough foreign policy," he said.
Senator Obama has suggested that he would "engage in aggressive personal diplomacy" with Iran to get it to behave "responsibly" and would organise a conference with Muslim countries "to have an honest discussion about ways to bridge the gap that grows every day between Muslims and the West".
"Smart" versus "tough" in foreign policy is going to be a theme of the campaign.