When Barack Obama addressed the Democratic convention on 27 July 2016, he knew he was fighting to keep his legacy.

At that point, most Democrats probably believed Hillary Clinton was going to emerge as victor. But those behind her campaign, knew that the input of her defeated rival Bernie Saunders, Vice President Joe Biden and Michelle Obama and the president could be crucial.

As such, with Ms Clinton positioning herself as a defender of his eight years of achievements and progress, the president was thinking of his legacy.

“I stand before you again tonight, after almost two terms as your President, to tell you I am more optimistic about the future of America than ever before,” he said.

The president was fighting to preserve his legacy (AP)

He added: “There is only one candidate in this race who believes in that future, has devoted her life to that future; a mother and a grandmother who would do anything to help our children thrive.”

His speech was soaring, energising. Many in the convention all in Philadelphia were in tears as the president urged them to do everything they could to ensure Ms Clinton was elected. She was not scheduled to speak until two nights later. As it was, she joined him on stage to share the applause and cheers.

As became clear in November, while many found Mr Obama electrifying, they were less excited about his anointed successors. A speech can only do so much, no matter how amazing it may be.

The speech in full

Hello, America! Hello, Democrats!

So 12 years ago tonight, I addressed this convention for the very first time. You met my two little girls, Malia and Sasha – now two amazing young women who just fill me with pride. You fell for my brilliant wife and partner Michelle – who has made me a better father and a better man; who’s gone on to inspire our nation as First Lady – and who somehow hasn’t aged a day.

I know, the same can’t be said for me. My girls remind me all the time. Wow, you’ve changed so much, Daddy. And then they try to clean it up – not bad, you're just more mature.

And it’s true – I was so young that first time in Boston. And look, I'll admit it, maybe I was a little nervous, addressing such a big crowd. But I was filled with faith; faith in America – the generous, big-hearted, hopeful country that made my story – that made all of our stories – possible.

A lot has happened over the years. And while this nation has been tested by war, and it's been tested by recession and all manner of challenges – I stand before you again tonight, after almost two terms as your President, to tell you I am more optimistic about the future of America than ever before.

How could I not be – after all that we’ve achieved together? After the worst recession in 80 years, we fought our way back. We’ve seen deficits come down, 401(k)s recover, an auto industry set new records, unemployment reach eight-year lows, and our businesses create 15 million new jobs.

After a century of trying, we declared that health care in America is not a privilege for a few, it is a right for everybody. After decades of talk, we finally began to wean ourselves off foreign oil. We doubled our production of clean energy. We brought more of our troops home to their families, and we delivered justice to Osama bin Laden.

Through diplomacy, we shut down Iran’s nuclear weapons program. We opened up a new chapter with the people of Cuba, brought nearly 200 nations together around a climate agreement that could save this planet for our children. We put policies in place to help students with loans; protect consumers from fraud; cut veteran homelessness almost in half. And through countless acts of quiet courage, America learned that love has no limits, and marriage equality is now a reality across the land.

By so many measures, our country is stronger and more prosperous than it was when we started. And through every victory and every setback, I’ve insisted that change is never easy, and never quick; that we wouldn’t meet all of our challenges in one term, or one presidency, or even in one lifetime.

So, tonight, I’m here to tell you that, yes, we’ve still got more work to do. More work to do for every American still in need of a good job or a raise, paid leave or a decent retirement; for every child who needs a sturdier ladder out of poverty or a world-class education; for everyone who has not yet felt the progress of these past seven and a half years. We need to keep making our streets safer and our criminal justice system fairer – our homeland more secure, our world more peaceful and sustainable for the next generation. We’re not done perfecting our union, or living up to our founding creed that all of us are created equal; all of us are free in the eyes of God.

And that work involves a big choice this November. I think it's fair to say, this is not your typical election. It’s not just a choice between parties or policies; the usual debates between left and right. This is a more fundamental choice – about who we are as a people, and whether we stay true to this great American experiment in self-government.

Look, we Democrats have always had plenty of differences with the Republican Party, and there’s nothing wrong with that. It’s precisely this contest of idea that pushes our country forward. But what we heard in Cleveland last week wasn’t particularly Republican – and it sure wasn’t conservative. What we heard was a deeply pessimistic vision of a country where we turn against each other, and turn away from the rest of the world. There were no serious solutions to pressing problems – just the fanning of resentment, and blame, and anger, and hate.

And that is not the America I know. The America I know is full of courage, and optimism, and ingenuity. The America I know is decent and generous. Sure, we have real anxieties – about paying the bills, and protecting our kids, caring for a sick parent. We get frustrated with political gridlock, and worry about racial divisions. We are shocked and saddened by the madness of Orlando or Nice. There are pockets of America that never recovered from factory closures; men who took pride in hard work and providing for their families who now feel forgotten; parents who wonder whether their kids will have the same opportunities that we had.

All of that is real. We are challenged to do better; to be better.

But as I’ve travelled this country, through all 50 states, as I’ve rejoiced with you and mourned with you, what I have also seen, more than anything, is what is right with America. I see people working hard and starting businesses. I see people teaching kids and serving our country. I see engineers inventing stuff, doctors coming up with new cures. I see a younger generation full of energy and new ideas, not constrained by what is, ready to seize what ought to be.

And most of all, I see Americans of every party, every background, every faith who believe that we are stronger together – black, white, Latino, Asian, Native American; young, old; gay, straight; men, women, folks with disabilities, all pledging allegiance, under the same proud flag, to this big, bold country that we love. That's what I see. That's the America I know!

And there is only one candidate in this race who believes in that future, has devoted her life to that future; a mother and a grandmother who would do anything to help our children thrive; a leader with real plans to break down barriers, and blast through glass ceilings, and widen the circle of opportunity to every single American – the next President of the United States, Hillary Clinton.

Let me tell you, eight years ago, you may remember Hillary and I were rivals for the Democratic nomination. We battled for a year and a half. Let me tell you, it was tough, because Hillary was tough. I was worn out. She was doing everything I was doing, but just like Ginger Rogers, it was backwards in heels. And every time I thought I might have the race won, Hillary just came back stronger.

But after it was all over, I asked Hillary to join my team. And she was a little surprised. Some of my staff was surprised. But ultimately she said yes – because she knew that what was at stake was bigger than either of us. And for four years – for four years, I had a front-row seat to her intelligence, her judgement, and her discipline. I came to realise that her unbelievable work ethic wasn’t for praise, it wasn’t for attention – that she was in this for everyone who needs a champion. I understood that after all these years, she has never forgotten just who she’s fighting for.

Hillary has still got the tenacity that she had as a young woman, working at the Children’s Defense Fund, going door-to-door to ultimately make sure kids with disabilities could get a quality education.

She’s still got the heart she showed as our First Lady, working with Congress to help push through a Children’s Health Insurance Program that to this day protects millions of kids.

She’s still seared with the memory of every American she met who lost loved ones on 9/11 – which is why, as a Senator from New York, she fought so hard for funding to help first responders, to help the city rebuild; why, as Secretary of State, she sat with me in the Situation Room and forcefully argued in favour of the mission that took out bin Laden.

You know, nothing truly prepares you for the demands of the Oval Office. You can read about it. You can study it. But until you’ve sat at that desk, you don’t know what it’s like to manage a global crisis, or send young people to war. But Hillary has been in the room; she’s been part of those decisions. She knows what’s at stake in the decisions our government makes – what’s at stake for the working family, for the senior citizen, or the small business owner, for the soldier, for the veteran. And even in the midst of crisis, she listens to people, and she keeps her cool, and she treats everybody with respect. And no matter how daunting the odds, no matter how much people try to knock her down, she never, ever quits.

That is the Hillary I know. That’s the Hillary I’ve come to admire. And that’s why I can say with confidence there has never been a man or a woman – not me, not Bill, nobody – more qualified than Hillary Clinton to serve as president of the United States of America.

I hope you don't mind, Bill, but I was just telling the truth, man.

And, by the way, in case you’re wondering about her judgement, take a look at her choice of running mate. Tim Kaine is as good a man, as humble and as committed a public servant as anybody that I know. I know his family. I love Anne. I love their kids. He will be a great Vice President. He will make Hillary a better President – just like my dear friend and brother, Joe Biden, has made me a better President.

Now, Hillary has real plans to address the concerns she’s heard from you on the campaign trail. She’s got specific ideas to invest in new jobs, to help workers share in their company’s profits, to help put kids in preschool and put students through college without taking on a ton of debt. That’s what leaders do.

And then there’s Donald Trump.

You know, the Donald is not really a plans guy. He’s not really a facts guy, either. He calls himself a business guy, which is true, but I have to say, I know plenty of businessmen and women who’ve achieved remarkable success without leaving a trail of lawsuits, and unpaid workers, and people feeling like they got cheated.

Does anyone really believe that a guy who’s spent his 70 years on this Earth showing no regard for working people is suddenly going to be your champion? Your voice?

If so, you should vote for him. But if you’re someone who’s truly concerned about paying your bills, if you're really concerned about pocketbook issues and seeing the economy grow, and creating more opportunity for everybody, then the choice isn’t even close. If you want someone with a lifelong track record of fighting for higher wages, and better benefits, and a fairer tax code, and a bigger voice for workers, and stronger regulations on Wall Street, then you should vote for Hillary Clinton.

If you’re rightly concerned about who’s going to keep you and your family safe in a dangerous world, well, the choice is even clearer. Hillary Clinton is respected around the world – not just by leaders, but by the people they serve.

I have to say this. People outside of the United States do not understand what’s going on in this election. They really don't. Because they know Hillary. They’ve seen her work. She’s worked closely with our intelligence teams, our diplomats, our military. She has the judgement and the experience and the temperament to meet the threat from terrorism. It’s not new to her. Our troops have pounded ISIL without mercy, taking out their leaders, taking back territory. And I know Hillary won’t relent until ISIL is destroyed. She will finish the job. And she will do it without resorting to torture, or banning entire religions from entering our country. She is fit and she is ready to be the next Commander-in-Chief.

Meanwhile, Donald Trump calls our military a disaster. Apparently, he doesn’t know the men and women who make up the strongest fighting force the world has ever known. (Applause.) He suggests America is weak. He must not hear the billions of men and women and children, from the Baltics to Burma, who still look to America to be the light of freedom and dignity and human rights. Applause.) He cozies up to Putin, praises Saddam Hussein, tells our NATO allies that stood by our side after 9/11 that they have to pay up if they want our protection.

Well, America’s promises do not come with a price tag. We meet our commitments. We bear our burdens. That’s one of the reasons why almost every country on Earth sees America as stronger and more respected today than they did eight years ago when I took office.

America is already great. America is already strong. And I promise you, our strength, our greatness, does not depend on Donald Trump. (Applause.) In fact, it doesn’t depend on any one person. And that, in the end, may be the biggest difference in this election – the meaning of our democracy.

Ronald Reagan called America “a shining city on a hill”. Donald Trump calls it “a divided crime scene” that only he can fix. It doesn’t matter to him that illegal immigration and the crime rate are as low as they’ve been in decades – because he’s not actually offering any real solutions to those issues. He’s just offering slogans, and he’s offering fear. He’s betting that if he scares enough people, he might score just enough votes to win this election.

And that's another bet that Donald Trump will lose. And the reason he'll lose it is because he’s selling the American people short. We're not a fragile people. We're not a frightful people. 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. We don’t look to be ruled. Our power comes from those immortal declarations first put to paper right here in Philadelphia all those years ago: We hold these truths to be self-evident, that all men are created equal; that we the people, can form a more perfect union.

That's who we are. That’s our birthright – the capacity to shape our own destiny. That’s what drove patriots to choose revolution over tyranny and our GIs to liberate a continent. It’s what gave women the courage to reach for the ballot, and marchers to cross a bridge in Selma, and workers to organise and fight for collective bargaining and better wages.

America has never been about what one person says he’ll do for us. It’s about what can be achieved by us, together – through the hard and slow, and sometimes frustrating, but ultimately enduring work of self-government.

And that’s what Hillary Clinton understands. She knows that this is a big, diverse country. She has seen it. She's travelled. She's talked to folks. And she understands that most issues are rarely black and white. She understands that even when you’re 100 percent right, getting things done requires compromise; that democracy doesn’t work if we constantly demonise each other. She knows that for progress to happen, we have to listen to each other, and see ourselves in each other, and fight for our principles but also fight to find common ground, no matter how elusive that may sometimes seem.

Hillary knows we can work through racial divides in this country when we realise the worry black parents feel when their son leaves the house isn’t so different than what a brave cop’s family feels when he puts on the blue and goes to work; that we can honour police and treat every community fairly. We can do that. And she knows – she knows that acknowledging problems that have festered for decades isn’t making race relations worse – it’s creating the possibility for people of goodwill to join and make things better.

Hillary knows we can insist on a lawful and orderly immigration system while still seeing striving students and their toiling parents as loving families, not criminals or rapists; families that came here for the same reason our forebears came – to work and to study, and to make a better life, in a place where we can talk and worship and love as we please. She knows their dream is quintessentially American, and the American Dream is something no wall will ever contain. These are the things that Hillary knows.

It can be frustrating, this business of democracy. Trust me, I know. Hillary knows, too. When the other side refuses to compromise, progress can stall. People are hurt by the inaction. Supporters can grow impatient and worry that you’re not trying hard enough; that you’ve maybe sold out. But I promise you, when we keep at it, when we change enough minds, when we deliver enough votes, then progress does happen. And if you doubt that, just ask the 20 million more people who have health care today. Just ask the Marine who proudly serves his country without hiding the husband that he loves.

Democracy works, America, but we got to want it – not just during an election year, but all the days in between.

So if you agree that there’s too much inequality in our economy and too much money in our politics, we all need to be as vocal and as organised and as persistent as Bernie Sanders supporters have been during this election. We all need to get out and vote for Democrats up and down the ticket, and then hold them accountable until they get the job done.

That's right – feel the Bern!

If you want more justice in the justice system, then we’ve all got to vote – not just for a President, but for mayors, and sheriffs, and state’s attorneys, and state legislators. That's where the criminal law is made. And we’ve got to work with police and protesters until laws and practices are changed. That's how democracy works.

If you want to fight climate change, we’ve got to engage not only young people on college campuses, we've got to reach out to the coal miner who’s worried about taking care of his family, the single mom worried about gas prices.

If you want to protect our kids and our cops from gun violence, we’ve got to get the vast majority of Americans, including gun owners, who agree on things like background checks to be just as vocal and just as determined as the gun lobby that blocks change through every funeral that we hold. That is how change happens.

Look, Hillary has got her share of critics. She has been caricatured by the right and by some on the left. She has been accused of everything you can imagine – and some things that you cannot. (Laughter.) But she knows that’s what happens when you’re under a microscope for 40 years. She knows that sometimes during those 40 years she’s made mistakes – just like I have; just like we all do. (Applause.) That’s what happens when we try. That’s what happens when you’re the kind of citizen Teddy Roosevelt once described – not the timid souls who criticise from the sidelines, but someone “who is actually in the arena.... who strives valiantly; who errs.... but who at the best knows in the end the triumph of high achievement.”

Hillary Clinton is that woman in the arena. She’s been there for us – even if we haven’t always noticed. And if you’re serious about our democracy, you can’t afford to stay home just because she might not align with you on every issue. You’ve got to get in the arena with her, because democracy isn’t a spectator sport. America isn’t about, “Yes, he will”. It’s about, “Yes, we can”. And we’re going to carry Hillary to victory this fall, because that’s what the moment demands.

Yes, we can. Not “Yes, she can” . Not “Yes, I can”. “Yes, we can”.

You know, there’s been a lot of talk in this campaign about what America has lost – people who tell us that our way of life is being undermined by pernicious changes and dark forces beyond our control. They tell voters there’s a “real America” out there that must be restored. This isn’t an idea, by the way, that started with Donald Trump. It’s been peddled by politicians for a long time – probably from the start of our Republic.

And it’s got me thinking about the story I told you 12 years ago tonight, about my Kansas grandparents and the things they taught me when I was growing up. See, my grandparents, they came from the heartland. Their ancestors began settling there about 200 years ago. I don’t know if they have their birth certificates – but they were there. They were Scotch-Irish mostly – farmers, teachers, ranch hands, pharmacists, oil rig workers. Hardy, small town folks. Some were Democrats, but a lot of them – maybe even most of them – were Republicans. Party of Lincoln.

And my grandparents explained that folks in these parts, they didn’t like show-offs. They didn’t admire braggarts or bullies. They didn’t respect mean-spiritedness, or folks who were always looking for shortcuts in life. Instead, what they valued were traits like honesty and hard work, kindness, courtesy, humility, responsibility, helping each other out. That’s what they believed in. True things. Things that last. The things we try to teach our kids.

And what my grandparents understood was that these values weren’t limited to Kansas. They weren’t limited to small towns. These values could travel to Hawaii.

They could travel even to the other side of the world, where my mother would end up working to help poor women get a better life; trying to apply those values. My grandparents knew these values weren’t reserved for one race. They could be passed down to a half-Kenyan grandson, or a half-Asian granddaughter. In fact, they were the same values Michelle’s parents, the descendants of slaves, taught their own kids, living in a bungalow on the south side of Chicago. (Applause.) They knew these values were exactly what drew immigrants here, and they believed that the children of those immigrants were just as American as their own, whether they wore a cowboy hat or a yarmulke, a baseball cap or a hijab.

America has changed over the years. But these values that my grandparents taught me – they haven’t gone anywhere. They’re as strong as ever, still cherished by people of every party, every race, every faith. They live on in each of us. What makes us American, what makes us patriots is what’s in here. That’s what matters.

And that’s why we can take the food and music and holidays and styles of other countries, and blend it into something uniquely our own. That’s why we can attract strivers and entrepreneurs from around the globe to build new factories and create new industries here. That’s why our military can look the way it does – every shade of humanity, forged into common service. That’s why anyone who threatens our values, whether fascists or communists or jihadists or homegrown demagogues, will always fail in the end.

That is America. That is America. Those bonds of affection; that common creed. We don’t fear the future; we shape it. We embrace it, as one people, stronger together than we are on our own. That’s what Hillary Clinton understands – this fighter, this stateswoman, this mother and grandmother, this public servant, this patriot – that’s the America she’s fighting for.

And that is why I have confidence, as I leave this stage tonight, that the Democratic Party is in good hands. My time in this office, it hasn’t fixed everything. As much as we’ve done, there’s still so much I want to do. But for all the tough lessons I’ve had to learn, for all the places where I’ve fallen short – I’ve told Hillary, and I’ll tell you, what’s picked me back up every single time: it’s been you. The American people. (Applause.)

It’s the letter I keep on my wall from a survivor in Ohio who twice almost lost everything to cancer, but urged me to keep fighting for health care reform, even when the battle seemed lost. Do not quit.

It’s the painting I keep in my private office, a big-eyed, green owl with blue wings, made by a seven year-old girl who was taken from us in Newtown, given to me by her parents so I wouldn’t forget – a reminder of all the parents who have turned their grief into action.

It’s the small business owner in Colorado who cut most of his own salary so he wouldn’t have to lay off any of his workers in the recession – because, he said, “that wouldn’t have been in the spirit of America.”

It’s the conservative in Texas who said he disagreed with me on everything, but he appreciated that, like him, I try to be a good dad.

It’s the courage of the young soldier from Arizona who nearly died on the battlefield in Afghanistan, but who has learned to speak again and walk again – and earlier this year, stepped through the door of the Oval Office on his own power, to salute and shake my hand.

It is every American who believed we could change this country for the better, so many of you who’d never been involved in politics, who picked up phones and hit the streets, and used the Internet in amazing new ways that I didn’t really understand, but made change happen. You are the best organisers on the planet, and I am so proud of all the change that you made possible. (Applause.)

Time and again, you’ve picked me up. And I hope, sometimes, I picked you up, too. And tonight, I ask you to do for Hillary Clinton what you did for me. (Applause.) I ask you to carry her the same way you carried me. Because you're who I was talking about 12 years ago when I talked about hope. It’s been you who fueled my dogged faith in our future, even when the odds were great; even when the road is long. Hope in the face of difficulty. Hope in the face of uncertainty. The audacity of hope.

America, you've vindicated that hope these past eight years. And now I’m ready to pass the baton and do my part as a private citizen. So this year, in this election, I’m asking you to join me – to reject cynicism and reject fear, and to summon what is best in us; to elect Hillary Clinton as the next President of the United States, and show the world we still believe in the promise of this great nation.