Alex Salmond has quoted Barack Obama's famous campaign slogan "yes we can" back at him after the US president gave his surprise backing to a UK which is "strong, robust, united and effective".

Mr Obama, who said this ­September's poll was a decision for the Scottish people, yesterday entered the referendum debate at a press conference with Prime Minister David Cameron after the G7 summit in Brussels.

Asked about Scotland's future, Mr Obama said: "There is a referendum process in place and it is up to the people of Scotland.

"The United Kingdom has been an extraordinary partner to us. From the outside at least, it looks like things have worked pretty well.

"And we obviously have a deep ­interest in making sure that one of the closest allies we will ever have remains a strong, robust, united and effective partner.

"But ultimately these are decisions that are to be made by the folks there."

The First Minister, who admires Mr Obama's campaigning skills, responded by saying: "We are deeply fortunate as a nation that we have the opportunity to gain our nation's independence in such a profoundly democratic way, as Mr Obama himself previously acknowledged.

"An independent Scotland will mean that America has two great friends and allies here rather than one.

"We are focused on ­securing a vote for independence this September and making Scotland a land of opportunity - and our message to the people of Scotland in the campaign in the months ahead is 'Yes we can'."

The No campaign hurriedly produced leaflets of Mr Obama's image under the word "Nope", and Downing Street was quick to talk up the significance of his remarks. Political sources also indicated the Americans had been inching towards such a declaration for months.

But some politicians accused Mr Obama of motives that involved more than simply ensuring the UK remained a strong "united" ally.

Scottish Green MSP Patrick Harvie suggested the US did not want to lose the UK's nuclear deterrent on the Clyde.

Defence experts have suggested the billions of pounds it would cost to relocate Trident after independence could prove prohibitive and even lead to the UK's unilateral disarmament.

The pro-union Better Together campaign said the comments marked an important moment in the campaign. Shadow Foreign Secretary Douglas Alexander said they were a "clear statement of support for the UK staying together" that would "resonate with many", while Scottish Labour leader Johann Lamont predicted Mr Obama's endorsement would give No voters "real confidence in their argument".

But others pointed out that former US President Bill Clinton had made a similar intervention in the run-up to Quebec's 1995 independence referendum, praising Canada's "notable achievement of national unity and progress". Quebec then came within one per cent of independence.

Blair Jenkins, chief executive of the pro-independence Yes Scotland campaign, said: "As President Obama said, the decision about Scotland's future is one for the people of Scotland to make."

He insisted: "After a Yes vote, the friendship between Scotland and the United States will flourish to the benefit of both nations."

Scottish Liberal Democrat leader Willie Rennie MSP said: "President Obama's remarks allow us to see ourselves as others see us. He clearly values the United Kingdom."