The orchestra wear hard hats and gas masks, the choir emerges from a swirl of tear gas-like smoke, and as the music swells, cutaway shots show crowds thousands-strong marching through the streets of Hong Kong.

The video is for the song Glory to Hong Kong, which was written as a protester anthem but has become something even bigger for many residents – a kind of national anthem for a city that never had one.

Facebook Twitter Pinterest Glory to Hong Kong performed.

It is sung and celebrated everywhere, from demonstrations to shopping malls, a ubiquitous soundtrack to a four-month-old movement that has itself expanded from an uprising against a controversial extradition law to embrace much broader pro-democracy aims, and a defence of Hong Kong’s way of life, the city’s civic freedoms and rule of law.

“It is widely regarded as an anthem for protesters who assert the Hong Kong identity,” said Kenneth Chan, a political science professor at Hong Kong Baptist University and former member of the ex-colony’s legislative council. “The Hong Kong identity is civic in essence, though clearly there has been a nationalistic turn in recent years, especially among younger people.”

Glory to Hong Kong’s Cantonese lyrics are part of its appeal, in a city where most people’s mother tongue has always come second to the language of distant authorities, whether the English of colonial rule or the Mandarin of Beijing.Partly crowd-sourced – in the spirit of the leaderless protests – these lyrics mix words that recognise the pain and bloodshed of the last four months with soaring tributes to the city’s people and hope for its future.

But both the music and the bulk of the lyrics are the work of one man, who has remained anonymous, making online posts under the name “Thomas”. He first thought the city needed an anthem during the “umbrella movement” five years ago, but couldn’t come up with anything that worked.

“The protest songs that Hong Kongers used to sing were not truly reflecting what we are facing or how we feel, and they couldn’t boost our morale as they were too pop-like,” he told the Observer an in an online interview. “I tried to write something then, but failed to come up with a melody that was good enough. Then I put it to the back of my mind until June this year.”

Facebook Twitter Pinterest Pro-democracy protesters clash with authorities in the streets of Hong Kong, in images from the video. Photograph: You Tube

When the protests started again, so did his nagging sense that a better protest song was needed. In the early days many marched to the hymn Sing Hallelujah to the Lord, but its Christian message meant it didn’t appeal to everyone; others favoured Do You Hear the People Sing from the musical Les Misérables, but it had no particular link to Hong Kong. So Thomas marched, and thought, and listened to other anthems, official and unofficial – he was particularly inspired by the US civil war song The Battle Hymn of the Republic – but also music as varied as baroque choral compositions and Japanese pop.

“Their music is often a mixture of desperation and hope,” he said, of the ‘J-pop’ songs, a combination that matches sentiment in Hong Kong. Protesters know they face daunting odds, up against the might of the Chinese state, but are determined to continue anyway. It took several months before Thomas managed to write something he thought worked. “I planned for an anthem, something solemn, that truly reflects our emotions and situation, something that can unite us all,” he said.

“You cannot create emotions without actual experience. I was with the crowd protesting through those months, and turning those memories and emotions into melody.”

He released the first version in late August, in an online forum used by protestors to coordinate; copyright is free for all non-commercial use. By mid-September, it seemed to be everywhere, both online and in the streets. Just one single version – with choir and orchestra in the protective outfits of “frontline” protesters, who have been battling riot police in the streets – has been seen over two million times on YouTube.

There are dozens of others, ranging from live footage of a spontaneous singalong to an acapella take, and ones with English-language lyrics.

Despite that popularity, he was surprised when people started talking of it as a national anthem – “The movement that started in June was nothing related to independence,” he said – but proud that it had achieved his original aim of unifying and inspiring the protesters.

“Music solidifies our beliefs, boosts our morale even in bad conditions,” he said. “As a musician, I may offer something more powerful, that helps people to become mentally strong. Helmets may protect them from a baton once or twice, but ideas are bulletproof.”