Mr Obama’s comments were the most forthright yet by any world leader and represented a major boost to the campaign to save the UK. It also undermined the Nationalists’ claim a separate Scotland would be warmly welcomed on the world stage.
Within minutes of the remarks, the pro-UK Better Together campaign had mocked up a pastiche of one of Mr Obama’s election posters, changing the slogan from “Hope” to “Nope”.
The President said it is in the US interest that Britain remains “robust and united”.
Speaking at a joint press conference with David Cameron at the G7 summit in Brussels, he said: “With respect to the future of the United Kingdom, obviously ultimately this is up to the people of Great Britain.
"In the case of Scotland, there is a referendum process in place and it’s up to the people of Scotland.
“But I would to say the United Kingdom has been an extraordinary partner to us. From the outside at least, it looks like things have worked pretty well."
“We obviously have a deep interest in making sure one of the closest allies we will ever remains a strong, robust, united and effective partner,” he said.
Prominent unionist politicians argued that he had “every right” to explain how independence would affect the Special Relationship with the US and his intervention would help voters realise how well regarded the UK is internationally.
“I welcome this important contribution by President Obama," said Douglas Alexander, the Labour shadow foreign secretary. "His clear statement of support for the UK staying together will resonate with many of us here in Scotland.
“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.”
Willie Rennie, the leader of the Scottish Liberal Democrats, said: "President Obama’s remarks allow us to see ourselves as others see us. He clearly values the United Kingdom. Although people here will decide for ourselves, his view is a significant contribution to our discussion about our future."
Speaking to BBC Radio Scotland, Mr Salmond said: “America had to fight for its independence. We are very fortunate in Scotland that we have a democratic, 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’.”
Furious Nationalists retaliated with a torrent of foul-mouthed abuse directed at the US President on Twitter, with many telling him to butt out of a Scottish decision.
Pete Wishart, a SNP MSP, said Scottish voters do not care what President Obama thinks, while other prominent Nationalist figures argued that the US wants to keep the UK as its “lapdog”.
International affairs experts had warned the US would be deeply unhappy about Mr Salmond’s plans to get rid of Britain’s Trident nuclear deterrent, but the extent to which the President was willing to attack separation surprised observers.
Lord Malloch-Brown, a Foreign Office minister in Gordon Brown's Labour government, expressed his "surprise" at Mr Obama's comments. He added: “I don't think it will be very helpful for anybody."
Genealogists believe they can trace Mr Obama’s ancestry to William the Lion, who ruled Scotland from 1165 to 1214. A maternal ancestor of Mr Obama, Edward FitzRandolph, is said to have emigrated from Scotland to America in the 17th century.
The First Minister invited him to attend the 2009 Homecoming Festival but did not receive a reply. The pair have never met.
However, the President led international condemnation in 2009 of the decision by Mr Salmond’s administration in Edinburgh to free the Lockerbie bomber and allow him to return to Libya to a hero’s welcome.
Experts have also warned that the US would vigorously oppose the First Minister’s plan to move Britain’s Trident nuclear submarines from the Clyde after independence.
There is widespread concern there is nowhere else suitable for them, meaning Britain would be forced to abandon its nuclear deterrent and Nato part of the “supreme guarantee” of its members’ security.
Mr Obama reiterated his call for Britain to remain in the European Union, saying Britain needs a “seat at the table” in Europe because the UK and US share a “strategic vision” on a range of international issues.
“In light of the events that we are going to be commemorating tomorrow, it’s important to recall that it was the steadfastness of Great Britain that in part allows us to be here in Brussels in the seat of a unified and extraordinarily prosperous Europe.”
“It’s hard for me to image that project going well in the absence of Great Britain, and it’s hard for me to imagine it would be advantageous for Great Britain to be excluded from political decisions that have an enormous impact on its economic and political life.”
“I’m sure the people of Britain will make the right decision,” he said.
Mr Cameron, Mr Salmond and Mr Obama will tomorrow attend a commemoration of the D-Day landings in Normandy.
Mr Obama said: "Whenever our two nations stand together, it can leave a world that is more secure and more prosperous and more just, and we will be reminded of that again tomorrow in Normandy as we mark the 70th anniversary of D-Day.
"On that day, like so many others, American and British troops stood together and fought valiantly alongside our allies. They didn't just help to win the war, they helped to turn the tide of human history and are the reason that we can stand here today in a free Europe and with the freedoms that our nations enjoy
"Theirs is the legacy that our two nations and our great alliance continue to uphold and I'm grateful to have a fine partner in David in making that happen."
Mr Cameron said: "As we stand together in Europe on the 70th anniversary of the D-Day landings, we should remind the world of the strength and steadfastness of the bond between the United Kingdom and the United States. Seventy years ago, our countries stood like two rocks of freedom and democracy in the face of Nazi tyranny.
"Seventy years ago tonight, thousands of young British and American soldiers, with their Canadian and Free French counterparts, were preparing to cross the Channel in the greatest liberation force that the world has ever known.
"Those young men were united in purpose, to restore democracy and freedom to continental Europe, to free by force of arms ancient European nations, and to allow the nations and peoples of Europe to chart their destiny in the world.
"Thousands of those young men paid the ultimate price and we honour their memory today and tomorrow. Shortly after D-Day my own grandfather was wounded and came home.
"We will never forget what they did and the debt that we owe them for the peace and the freedom that we enjoy on this continent."