Media playback is unsupported on your device Media caption Obama passes the baton to Clinton with a message of "hope"

US President Barack Obama has delivered a stirring speech at the Democratic convention, hailing Hillary Clinton as his political heir and rounding on "home-grown demagogue" Donald Trump.

"There has never been a man or woman, not me, not Bill, nobody more qualified than Hillary" to be president, he said.

When boos rang out at the name of the Republican candidate, Mr Obama simply said: "Don't boo. Vote."

Mr Trump responded by rejecting the president's portrayal of optimism.

"Our country does not feel 'great already' to the millions of wonderful people living in poverty, violence and despair," he said on Twitter.

Mr Obama extolled Mrs Clinton's character, calling her a "leader with real plans to break down barriers, blast through glass ceilings and widen the circle of opportunity to every single American".

"She's been there for us, even if we haven't always noticed," he said.

Mr Obama described his nation as "full of courage", "decent and generous", but also concerned about racial divisions and "frustrated with political gridlock".

He said: "Tonight, I ask you to do for Hillary Clinton what you did for me. I ask you to carry her the same way you carried me."

The optimistic high ground - BBC's Anthony Zurcher

Image copyright Reuters

President Obama is good at this. He's really, really good at this.

For all his flaws - and conservatives will be quick to point them out - he's always been able to deliver a pitch-perfect speech on the biggest stages, and this was no exception.

It was the kind of speech that had some conservatives shaking their heads, wondering how their party ceded the optimistic high ground to their opponents. Mr Obama even quoted Ronald Reagan's "shining city on a hill" line, if only to make the political shift all the more clear.

Read more from Anthony

But he also reserved fierce words for Mr Trump, challenging the Republican's view of the US as "a divided crime scene".

Mr Obama said the US he knew was not a "country where we turn against each other, and turn away from the rest of the world".

He added: "Our power doesn't come from some self-declared saviour promising that he alone can restore order as long as we do things his way."

Media playback is unsupported on your device Media caption Biden and Kaine take aim at Trump

Media playback is unsupported on your device Media caption Huge cheers for former Congresswoman Gabby Giffords

Turning to Mr Trump's business acumen, he said: "I know plenty of businessmen and women who have achieved remarkable success without leaving a trail of lawsuits and unpaid workers and people feeling like they got cheated."

Mr Obama added: "Does anyone really believe that a guy who spent his 70 years on this Earth showing no regard for working people is suddenly going to be your champion, your voice? No."

The former secretary of state joined him on stage for a hug after he finished speaking.

Role reversals and political divides - US media react

Writing in the Washington Post, EJ Dionne Jr says that Mr Obama's mission in his speech was to try "to safeguard his legacy by ensuring his time in the White House would not be seen by history as having culminated in the election of Donald Trump. And so he went to work, combining rational argument with evangelical exhortation in the classic Obama fashion".

Julie Hirschfeld Davis and Michael Shear in the New York Times recall Mr Obama's speech at the 2004 convention that thrust him into the national spotlight, in which he rejected the "politics of cynicism". His challenge now, they say, is "to find a way to acknowledge that the political divides he promised to bridge have only grown deeper and more acrimonious while arguing persuasively that the way to rise above them is to elect Mrs Clinton".

On the Politico website, Michael Hirsh says Wednesday's speeches confirmed "a dramatic shift, perhaps even a reversal, of the roles the two major parties have been identified with for several decades. For the first time, perhaps, since Vietnam, the Democratic Party is now the party of national security expertise."

In his response, Mr Trump said in a statement that the Democrats had described a vision of America that did not exist for most people.

Seventy percent of Americans thought the country was on the wrong track, said the property developer, who defied all predictions to win the Republican primary contest.

"Never has a party been so disconnected from what is happening in our world."

'Not one word'

Vice-President Joe Biden earlier delivered his own spirited address, saying Mr Trump "backs torture", "religious intolerance" and "betrays our values".

"He has no clue about what makes America great," Mr Biden said, before the crowd started chanting, "Not a clue!"

Image copyright Reuters Image caption Mr Kaine reveals his impression of Donald Trump

Virginia Senator Tim Kaine took the stage to "humbly" accept his party's nomination for vice-president and then also went on the attack.

"Folks, you cannot believe one word that comes out of Donald Trump's mouth," he said.

The crowd then erupted into chants of "Not one word!"

In other highlights from Wednesday night:

Former Arizona congresswoman Gabby Giffords, critically injured in a 2011 shooting, described Mrs Clinton as a president who would "stand up to the gun lobby"

Former CIA director Leon Panetta was greeted with chants of "no more war!" as he tried to warn of dangerous foreign policy under a Trump presidency

Ex-New York Mayor Michael Bloomberg attacked fellow billionaire Donald Trump, saying: "The richest thing about him is his hypocrisy"

Christine Leinonen, mother of one of the victims of the Orlando nightclub shooting, made an emotional plea for gun control

Mrs Clinton will officially accept the nomination on Thursday, setting up an election fight with Mr Trump that will take them to the presidential election in November.