Barack Obama has called on young people to "stay angry" in the fight against climate change at the COP26 summit.
The former US president urged them to apply political pressure to make a change, but warned they would need to accept compromises along the way.
Mr Obama said the world is "nowhere near where we need to be" to avoid a future climate catastrophe.
He criticised Donald Trump's "active hostility toward climate science", but said the US is ready to lead again.
Mr Obama also scolded China and Russia's leaders for not physically attending the COP26 summit.
Speaking in Glasgow, Mr Obama received rapturous applause when he took to the stage and a standing ovation at the end of his speech - but there was pushback from activists.
He called out nations for failing to meet the pledges they made in the 2015 Paris Agreement, when he was in the White House.
However, activists were quick to point out those broken by his own administration, including the failure of a key promise by developed countries to deliver $100bn (£73bn) a year in climate finance to poorer nations.
Mr @BarackObama, I was 13 when you promised $100B #ClimateFinance. The US has broken that promise, it will cost lives in Africa. Earth's richest country does not contribute enough to life-saving funds. You want to meet #COP26 youth. We want action. Obama & @POTUS #ShowUsTheMoney pic.twitter.com/40HCsqA5s3— Vanessa Nakate (@vanessa_vash) November 8, 2021
Perhaps a little unsure of his location in Scotland, Obama referred to being in the "Emerald Isles", seemingly a mistaken reference to Ireland, which is known poetically as the Emerald Isle. He also quoted Shakespeare, who was English.
He admitted there is still a lot of hard and messy work to do to reduce the effects of climate change, but said some promising progress had been made in the six years since the signing of the Paris Agreement, which he helped spearhead.
'You can't ignore politics'
Mr Obama dedicated much of his speech to young activists, who he said were "right to be frustrated".
Addressing young people directly, he said they "can't ignore politics" and that while protesting and hashtags raise awareness, they should get involved in politics at some level.
"You don't have to be happy about it, but you can't ignore it. You can't be too pure for [politics]."
Referencing his own daughters' shopping habits, he also called on young people to support businesses that were committed to sustainability, and boycott those that were not.
Obama's catchphrase of the night was telling young activists to "stay angry".
"To all the young people out there - I want you to stay angry. I want you to stay frustrated," he said.
"But channel that anger. Harness that frustration. Keep pushing harder and harder for more and more. Because that's what's required to meet that challenge. Gird yourself for a marathon, not a sprint."
He honoured the dedication of activists such as Greta Thunberg who are "forming movements across borders", and urged young people to at least get out and vote for politicians who will stand against climate change.
"Vote like your life depends on it, because it does", he said.
The former president insisted that despite political divisions in the US and the country's absence from global climate efforts for four years during the Trump administration, America was now back on track and committed to change.
Mr Obama made a number of comments about his predecessor, Republican Donald Trump, who once called climate change "an expensive hoax" and controversially pulled out of the Paris climate accord when he took office. The US rejoined it under Joe Biden.
Mr Obama reserved some of his strongest criticism for the Republican Party. He accused its members of stalling progress by "sitting on the sidelines" and making climate change a partisan issue with "four years of active hostility toward climate science".
He said Republicans who take climate change seriously are "a rare breed right now." This is the first year a delegation of Republicans has attended a UN climate summit.
Mr Obama also blamed the pandemic, rise of US nationalism and a lack of cooperation from the Trump administration for a breakdown in international relations that has affected the climate crisis.
Taking a swipe at Russia and China, Mr Obama also said it was "particularly discouraging" that the leaders of "two of the world's largest emitters" had not attended the climate summit in person.
While more than 120 leaders turned up at the conference, Vladimir Putin and Xi Jinping, who have both avoided international travel since the start of the pandemic, opted to take part remotely instead.
Mr Obama said they were showing a "dangerous lack of urgency".
The 44th US president closed by telling the crowd that fighting climate change will be hard and messy with "every victory incomplete".
"The thing we have going for us is that humanity has done hard things before," he said, adding: "I believe we can do hard things again."
A delicate balance of hope and doubt
Barack Obama's speech to COP26 was a study in hope and doubt.
He touted the work his administration and that of Joe Biden have accomplished in addressing climate change, while acknowledging he wasn't "real happy" about what the Trump administration had done in the intervening four years.
He lamented the fierce opposition Republicans have mounted toward addressing climate change in the US and the rise of tribalism and nationalism around the world, but pointed to efforts by states, local governments and private citizens to fill the policy void.
He heralded the international co-operation evident during the Paris climate negotiations and in Glasgow over the past week, but said much more needs to be done. He even acknowledged that he doesn't have all the answers and at times gets discouraged, but he said the energy and efforts of young people give him faith in the future.
It was a delicate balance for a former president who made "hope and change" his trademark line.
But the rhetoric was reflective of the tenuous nature of current US climate polices, which are dependent on Democratic majorities that could vanish in coming elections even though, Mr Obama said, there is still much work left to do.