Media playback is unsupported on your device Media caption Barack Obama was speaking alongside Prime Minister David Cameron

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.

The US has stayed neutral on the Scottish question: the US ambassador to the UK told me last October that it was the policy of the US to stay out of the Scottish referendum

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."

Media playback is unsupported on your device Media caption First Minister Alex Salmond says to President Obama: "Yes we can"

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.

Analysis The United States said that it would remain "neutral" in the debate over Scottish independence. This position was articulated by the US ambassador to the UK, Matthew Barzun in October 2013. In a BBC interview he said "we don't get into picking sides". His predecessor Louis Susman said much the same thing in February 2013. "We are neutral and we will just have to see what will happen" he told the BBC. The position appears to have changed. While President Obama has made clear that it's up to Scots to decide, he also indicated support for the UK remaining "united". The Better Together campaign believes his remarks will "resonate" with Scottish voters ahead of the referendum. The former deputy secretary general of the UN, Lord Malloch-Brown has previously suggested an American intervention could backfire. In his response, First Minister Alex Salmond quoted president Obama's famous campaign slogan back at him. Mr Salmond said that his message to the president on Scottish independence was "yes we can".

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."