BANGKOK — The rhymes came to Nutthapong Srimuong before dawn, when Bangkok is as still as it can be and the night jasmine overpowers the Thai capital with its perfume.

The country whose capital is turned into a killing field

Whose charter is written and erased by the army’s boots

The country that points a gun at your throat

Where you must choose to eat the truth or bullets

A largely nocturnal individual, Mr. Nutthapong, 30, had worked on a few bars of a rap song, “What My Country Has Got,” for months. Then he abandoned the project.

But the rule of Thailand’s military junta had stretched past the four-year mark. Restrictions on free speech showed little sign of abating. Elections, frequently promised, never materialized.

In late October, a group of musicians called Rap Against Dictatorship, led by Mr. Nutthapong, released “What My Country’s Got.” Within a week, the music video had collected 20 million views online — in a country of 70 million people with a general aversion to dissent borne of prison sentences meted out to those who oppose the government.

“Thais have been taught that politics are disconnected from their lives, but I want people to know they have rights to elections and democracy,” said Mr. Nutthapong, who raps under the name Liberate P, the P standing for “the people.”

“I wanted this song to bring out our voices, but I never expected it to have such a big impact,” he added. “It shows that even grass-roots people are tired and want change.”

In 2014, a military group, the National Council for Peace and Order, led Thailand’s 12th successful coup since absolute monarchy was abolished in 1932.

Image

Mr. Nutthapong in the 8lack Music Studio recording space in Bangkok.CreditThe New York Times

After repeated delays, Prayuth Chan-ocha, the coup leader and now the country’s prime minister, set elections for March 24, but efforts to kneecap the political opposition have left little hope of free and fair polls.

A country best known internationally for its golden beaches and temples has instead made headlines for the junta’s political prohibitions — arresting people for reading George Orwell’s dystopian novel “1984” in public, for example, or flashing the defiant, three-fingered salute from the “Hunger Games” films and books.

Hundreds of Thais have been sent to “attitude adjustment” camps. A computer crimes act and a sedition law have been used to imprison activists, human rights groups say.

As more and more Thais listened to “What My Country’s Got,” the government responded with its own rap song, “Thailand 4.0.”

“There are lots of talented Thais if we work together,” went one lyric that accompanied a video in which a bespectacled girl built a robot. To date, the video has been viewed 4.6 million times, compared with 56 million for “What My Country’s Got.”

Mr. Prayuth, who has written several syrupy songs of his own, including “Fight for the Nation,” blasted Rap Against Dictatorship’s harder-edged effort.

“Anyone who shows appreciation for the song must accept responsibility for what happens to the country in the future,” he told the local news media. Talk of a criminal investigation ensued, and Mr. Nutthapong worried about arrest.

But Mr. Prayuth is running for prime minister in next month’s polls, and detaining the rapper behind a viral video is not a winning campaign strategy.

Still, distaste for the song lingers in pro-military circles.

On Facebook, Suthep Thaugsuban, a veteran politician who supports the junta, wrote that the rappers “were born Thai, but they express themselves in such a disgusting, abominable way and think to destroy their own homeland.”

Image

The Thai prime minister, Prayut Chan-ocha, arriving at the Grand Palace in Bangkok in 2016 to pay respects after the death of King Bhumibol Adulyadej.CreditLillian Suwanrumpha/Agence France-Presse — Getty Images

Mr. Nutthapong puts things differently.

“I love Thailand,” he said. “I want a country that I can be proud of.”

Mr. Nutthapong grew up in Chanthaburi, a province in eastern Thailand known for its durian, a stinky and spiky fruit. Thai pop, with its bubble-gum sweetness, was not for him. He gravitated instead to American rap.

Following in his father’s footsteps, Mr. Nutthapong studied architecture in college in Bangkok. Eleven years later, he’s still not quite done with his thesis. Rap, in all its windowless studio intensity, got in the way of his diploma.

Even if his fine-boned features and strategically tousled hair seem more suited for a performer in a boy band, Mr. Nutthapong began dredging up some of Thailand’s darkest history in his rhymes. His audience has followed. In just the past week, a half million more people viewed Rap Against Dictatorship’s video.

In one of his earlier rap songs, “Oc(t)ygen,” Mr. Nutthapong mined a turbulent period in the 1970s, when dozens of Thai protesters, many of them college students, were massacred by security forces and right-wing mobs.

You have guns and power but you don’t have the right to take away lives

Those killings were memorialized in a Pulitzer Prize-winning photograph from 1976 of a lifeless student dangling from a tree as a man swings at the corpse with a folded chair. This episode, like other bloody crackdowns on dissent over the decades, is missing from Thai schoolbooks.

“They want us to forget everything,” Mr. Nutthapong said.

In the video for “What My Country’s Got,” shot in black and white, the lynching at Thammasat University in Bangkok is re-enacted, a man heaving a chair at a hanging dummy as a mob cheers him on. Mr. Nutthapong, rage rippling across his face, enters the frame.

The country that makes fake promises like loading bullets

Creates a regime and orders us to love it

In 2006, after a break of 15 years, the military again left the barracks to topple Thaksin Shinawatra, a brash billionaire who had threatened traditional power bases.

Mr. Thaksin is now in self-exile after a corruption-linked conviction but parties aligned with him have prevailed in every election this century.

Image

Hockhacker, Jacoboi and Mr. Nutthapong, whose stage name is Liberate P, in the 8lack Music Studio.CreditThe New York Times

When security forces cleared the streets of protesters loyal to Mr. Thaksin, scores were killed.

“It’s the same loop over and over,” Mr. Nutthapong said, of Thailand’s brand of democracy interruptus: elections followed by coups, interspersed with bloodletting on the streets.

“The only bargaining power the people have is democracy, but everything looks like it’s in the dark and there’s no way out,” he added.

Next month’s election, which is circumscribed by a military-drafted constitution that keeps much of the power in the army’s hands, brings him little hope.

“With the upcoming election, it was unfair from the beginning,” he said. “People are in servitude.”

But just because younger Thais are disenchanted with the current state of politics doesn’t mean that they will be placated by air-conditioned malls and the latest in selfie technology.

“I grew up in a province that is full of fruits and good soil,” Mr. Nutthapong said. “Sweet things are not enough. We need freedom.”

Despite threats of detention, college students have led rallies against the junta. A 40-year-old heir to an auto parts business has started his own political party.

For millions of others, listening to a rap anthem of dissent is their outlet, even as the junta recently suspended broadcast of a TV station linked to Mr. Thaksin, saying it incited conflict in society and threatened national security.

“Do they think we can be shut up forever?” Mr. Nutthapong asked. “Do they have that low an opinion of Thai people?”

As Thailand’s political parties restarted their rusty machinery in preparation for an election neither free nor fair, Mr. Nutthapong was working again in the dark hours, recording a new Rap Against Dictatorship song, “Capitalism,” which he described as a meditation on income inequality and human rights.

Correction:Feb. 16, 2019

Because of an editing error, an earlier version of a picture caption with this article included inaccurate information. The photo, of Nutthapong Srimuong and two other members of Rap Against Dictatorship, was taken in November, not January.

Ryn Jirenuwat contributed reporting.

A version of this article appears in print on , on Page A6 of the New York edition with the headline: A Thai Rapper Takes On The Junta, and Goes Viral. Order Reprints | Today’s Paper | Subscribe