By John Simpson
BBC World Affairs Editor
The United States has seen the biggest transformation in its standing in the world since the election of John Fitzgerald Kennedy in November 1960.
The world's expectations of an Obama administration are high
This is a country which has habitually, sometimes irritatingly, regarded itself as young and vibrant, the envy of the world. Often this is merely hype. But there are times when it is entirely true.
With Barack Obama's victory, one of these moments has arrived.
The US has never been so unpopular, so derided, and so dismissed by the outside world as it has in the latter stages of George W Bush's presidency. The other day I asked Madeleine Albright, President Clinton's formidable secretary of state, if she could remember a time when people hated America so much.
"Not in my lifetime," she answered. "I feel very strongly about this country, and what an exceptional, amazing country it is. But I honestly think this is about as bad as I've seen it."
Opinion polls around the world have confirmed America's unpopularity. And the chance that a young, apparently pleasant and modest black man might become its president was greeted favourably everywhere.
Last summer a poll for the BBC World Service, conducted in 22 countries, indicated that people preferred Barack Obama to John McCain by four to one. Almost half said that if Senator Obama were elected, it would change their view of the United States completely.
America is no longer the power it was. It can still lead, but it is no longer in a position to dictate to the wider world
For eight years the word that people around the world have used again and again to describe the approach of George W Bush's presidency is "arrogance". The tone in Washington seemed to be one of superiority amounting almost to contempt.
Think of the speeches by men like Donald Rumsfeld, Paul Wolfowitz or Paul Bremer. All were closely concerned with the occupation of Iraq, which was carried out in defiance of opinion in most of the rest of the world.
Why did the US invade Iraq? "Because we are America," said another leading figure in the enterprise, famously. "We can."
Outside this country, most people would probably agree with Madeleine Albright's judgement when she spoke to me: "I think Iraq will go down in history as the greatest disaster of American foreign policy - worse than Vietnam."
In the rush to war in 2003, when many American politicians were frightened to stand out against the crowd, Barack Obama condemned the invasion loudly and publicly.
The fact that he has been elected president is his reward for that. And everyone around the world who felt that the Iraq war was wrong will feel that America has now chosen a different path - a path that leads away from extraordinary rendition, Guantanamo, Abu Ghraib, waterboarding and all the rest of it.
America is no longer the power it was. Without meaning to, President Bush demonstrated that. It can still lead, but it is no longer in a position to dictate to the wider world.
A black family in the White House will change America's image abroad
Barack Obama clearly understands this. As an African-American (literally, since his father was from Kenya) his background is not one of privilege and superiority. He will be open to the world in a way President Bush never was. And he will show once again the value of the American dream.
This is no guarantee that he will be a success as president. Jimmy Carter understood the US's reduced position in the post-Vietnam world, and he refused to dictate to the world. Nowadays most Americans regard him as a failure.
But the outside world is set to be delighted by Barack Obama's victory. And its view of America will change accordingly.