Ariana Grande took to the stage for a solo encore and sang a highly emotional version of Over the Rainbow.

At the very end of Sunday’s One Love Manchester concert, after the big celebrity singalong, Ariana Grande took to the stage for a solo encore and sang a highly emotional version of Over the Rainbow. It was the perfect song for the moment – a song well known to everyone watching, one that speaks to young and old alike, always bringing with it a universe of hope and optimism against a backdrop of yearning. And at that moment, in front of those fans, it reduced both Ariana and her audience (in Old Trafford and watching at home) to tears.

It’s not the first time that this Oscar-winning song has offered hope and consolation to people in extreme circumstances. From the moment it was written, for the 1939 film The Wizard of Oz, Over the Rainbow took on a significance greater than the moment it was intended to soundtrack. And that’s partly because the duo who wrote it – composer Harold Arlen and lyricist Yip Harburg – had known some fairly hard times themselves.

Yarburg in particular had been born poor in New York, the son of Jewish immigrants. Having worked his way into prosperity in electrical supplies, his business was wiped out by the Great Depression, leaving him with nothing but his wits and a promising sideline in writing. He told the New York Times: “The capitalists saved me in 1929, just as we were worth, oh, about a quarter of a million dollars. Bang! The whole thing blew up. I was left with a pencil and finally had to write for a living… what the Depression was for most people was for me a lifesaver!”

His first hit, Brother Can You Spare a Dime?, was a bittersweet lament from the perspective of a homeless man who can’t find work, but Harburg’s speciality was lyrics that pined for a better tomorrow. “We worked for in our songs a sort of better world, a rainbow world,” he once said. “Now, my generation unfortunately never succeed in making that rainbow world, so we can’t hand it down to you. But we could hand down our songs, which still hang on to hope and laughter… in times of confusion.”

At the time Over the Rainbow was written, that confusion was caused by a huge financial slump, but by the time it came out, families were becoming caught up in World War II. A special recording of the song by Judy Garland and the Tommy Dorsey Orchestra was pressed and sent out to American soldiers as a promise of better times to come. She also performed it live for the troops in 1943.

Garland’s version later became an anthem of possibility for LGBT+ people, the “rainbow” in the lyrics matching the multicoloured flag of inclusion flown at Pride marches, and the term “friend of Dorothy” even becoming a knowing reference for gay men. Her frail and trembling voice embodied both the fragility of hope in dark times, and the yearning that something good will eventually happen.

But it’s not just her version that has touched people down the years. Many artists have covered the song, from Willie Nelson to Rufus Wainwright to the cast of Glee, and it’s been used by NASA to awaken their astronauts, who have most certainly gone over the rainbow. The song was also recorded by the choir of Sandy Hook Elementary and Ingrid Michaelson, as a healing moment after the 2012 mass shooting at the school.