U.S. President Barack Obama painted an optimistic picture of America's future in a rousing speech on Wednesday that offered full-hearted support to Hillary Clinton in her campaign to defeat Republican Donald Trump and become the first woman elected U.S. president.

"There has never been a man or woman, not me, not Bill [Clinton] — nobody more qualified than Hillary Clinton to serve as president of the United States," Obama said to cheers at the Democratic National Convention in Philadelphia.

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

After Obama's speech, Clinton joined him on stage where they hugged, clasped hands and waved to the crowd.

Obama: I’m ready to pass the baton'2:56

Obama and Clinton were rivals in the hard-fought campaign for the 2008 Democratic nomination. After winning that election to become America's first black president, he appointed her his secretary of state, which he said gave him a "front-row seat to her intelligence, her judgment and her discipline."

Obama: Clinton 'like Ginger Rogers'1:57

Speaking to delegates, Obama offered an alternative to businessman Trump's vision of the United States as being under siege from illegal immigrants, crime and terrorism and losing its way in the world.

"I am more optimistic about the future of America than ever before," Obama said at the Wells Fargo Center.

Obama listed what he described as a series of advances during his two terms in office, such as recovery from economic recession, the Obamacare health care reform and the 2011 killing of al Qaeda leader Osama bin Laden.

Such changes happened because "progress is possible," he said.

Obama: 'Democracy works'1:20

Like many other speakers this week, Obama spoke about Clinton's qualifications, but also acknowledged that she had her critics and had made mistakes.

"That's what happens when we try," he said.

Obama: 'Democracy isn't a spectator sport'1:54

Clinton made history on Tuesday when she became the first woman to secure the presidential nomination from a major party.

When she formally accepts it on Thursday, she will become the Democratic standard-bearer against Republican nominee Trump in the Nov. 8 election.

Obama took aim at Trump's campaign slogan and promise to "Make America Great Again."

"America is already great. America is already strong. And I promise you, our strength, our greatness, does not depend on Donald Trump," he said.

"Preach!" members of the crowd shouted. "Best president ever," someone screamed.

When voters booed at Trump's name, Obama quickly retorted "don't boo. Vote."

Nodding to voters' concerns, Obama said he understood frustrations "with political gridlock, worry about racial divisions" and the slow pace of economic growth.

He said he hasn't fixed everything and there are many challenges ahead – for the country and Clinton – but he's confident the Democratic Party and the country are in good hands.

Obama: 'There’s still so much I want to do'1:39

With files from CBC News