Scottish independence: Barack Obama backs 'strong and united' UK
Barack Obama has said the interest of the US in the Scottish independence referendum issue was to ensure it retained a "strong, robust, united and effective partner".
But the US president told reporters in Brussels the decision was "up to the people of Scotland".
In response, Scottish First Minister Alex Salmond quoted Mr Obama's campaign slogan: "Yes we can".
Mr Obama also expressed his disquiet at the prospect of the UK leaving the EU.
The president was speaking alongside UK Prime Minister David Cameron at a media conference following the G7 summit.
Mr Obama was asked what the decisions on Scottish independence and the UK's membership of the EU meant to him and the American people.
Referring to the independence debate, 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."
Mr Obama also said he thought it "hard to be advantageous" for the UK to leave the EU.
He said it was good for the UK "to have a seat at the table" and said that, if the UK was excluded, it would have an "enormous impact" on the UK's economic and political life.
Mr Salmond said independence for Scotland would mean: "America has two great friends and allies here rather than one".
He added: "Rather more than 200 years ago, America had to fight for its independence.
"We are very fortunate in Scotland that we have a democratically agreed, consented process by which we can vote for our independence.
"So in summary, I suppose my message to President Obama is: Yes we can."
The Scottish government has previously said that an independent Scotland would retain close ties with the rest of the UK and the United States in the event of a "Yes" vote in the referendum, which will be held on 18 September.
In February last year, the then US ambassador to Britain, Louis Susman, said the Washington government was watching the independence debate unfold and would be staying "neutral".
Meanwhile, a former deputy secretary-general of the United Nations has expressed his "surprise" at Mr Obama's comments.
Lord Malloch-Brown, who was also a foreign office minister in Gordon Brown's Labour government, had previously said the US would be wise to keep out of the Scottish independence debate claiming "foreign, unsolicited advice is only going to anger Scots".
Following Mr Obama's remarks, he said: "I'm surprised that he has stepped into this. I don't think it will be very helpful for anybody."
But Shadow Foreign Secretary and Scottish Labour MP Douglas Alexander welcomed what he said was an "important contribution by President Obama" to the referendum debate.
Speaking on behalf of the pro-UK Better Together campaign, Mr Alexander said the US president's "clear statement of support for the UK staying together will resonate with many of us here in Scotland".
He added: "As a global statesman President Obama understands that interdependence is a defining feature of our modern world, and that building bridges, not putting up new barriers, is the challenge of our generation."