Near midnight on the outskirts of the Latvian capital, close to 100,000 spectators joined 16,500 singers last week in a song about a mystical castle that is submerged when foreign powers hold sway only to rise again.
The castle is a metaphor for their nation. The foreign powers?
Well, from the 20th century, take your pick. First it was the Russians. Then the Germans. Then the Russians again. Only in the last quarter-century has Latvia been able to reclaim its nationhood, and only in the last decade has it felt secure in that claim.
The security came from one thing: joining NATO, an alliance of nations forged after the fires of World War II and expanded during the Cold War as a buffer against Soviet aggression.
Now, with Russia once again on the prowl, that alliance seems to be at risk in ways that were virtually inconceivable when Latvia joined in 2004.
As President Trump joins his second NATO summit meeting — having called the alliance “obsolete,” derided its members as deadbeats and suggested that American military protection is negotiable — there is deep unease on the alliance’s eastern flank. And that sense has only been heightened by Mr. Trump’s scheduled one-on-one meeting next week with President Vladimir V. Putin of Russia.
The United States ambassador to Estonia, James D. Melville Jr., became so exasperated with the constant statements from Mr. Trump disparaging the alliance and the European Union that late last month he quit in disgust.
And as the Trump-Putin meeting approached, a popular Russian-language Latvian newspaper ran a picture of the two men, cheek by jowl, with the ominous headline: “What Will Trump and Putin Agree On: The End of the E.U.?”
For the nations of Latvia and Estonia, nestled between Russia and the Baltic Sea and with large ethnic Russian populations, NATO is no abstraction.
Long before the debate over the Kremlin’s interference in the American election, there was alarm in the Baltic nations over Russian attempts to influence public opinion and exploit the complicated issues of ethnic identity in a region reshaped by war and occupation. In both the annexation of Crimea and its actions in Ukraine, the Russian government has used protecting the rights of ethnic Russians as a pretext for intervention. About one-third of the populations of Latvia and Estonia are ethnic Russians.
Even as Mr. Trump has railed against NATO, the United States military has continued to lead the alliance in combating what is now commonly referred to as Russian hybrid warfare: asymmetric and nontraditional military capabilities used to destabilize democracies through cyberattacks, disinformation and propaganda campaigns.
NATO member nations have also devoted energy and resources to improving battle readiness and the speed of deployment, in the event they should face a sudden crisis with their aggressive neighbor to the east.
During a visit to Latvia on his way to the NATO meeting, Prime Minister Justin Trudeau of Canada acknowledged that “these are uncertain times” and said that NATO must remain alert to “changing threats.”
He condemned Russia for its annexation of Crimea, its actions in Ukraine and what British intelligence says is its involvement in the use of a nerve agent in England, which has evolved into a murder case after the death of a British woman last Sunday.
Mr. Trudeau sidestepped questions about his relationship with Mr. Trump, who derided the Canadian leader as “very dishonest and weak” after the Group of 7 summit meeting in June. But he said that Canada’s decision to increase its military spending 70 percent over the next decade was not the result of pressure from Washington, but rather a response to new and emerging threats.
But for all the fighting over financial contributions to NATO from member states, the struggle in the Baltics to confront sophisticated propaganda campaigns aimed at ethnic Russian populations showed that it will take more than money and beefed up military forces to counter the emerging threat.
In that new fight, culture is a battleground — and music is a weapon. The Czech Republic had its Velvet Revolution, but Latvia’s struggle to break free from the Soviet Union is known as the Singing Revolution.
Last week, in what organizers described as “a national cultural vaccination that’s administered every five years,” the country held its Latvian Song and Dance Festival, a seven-day extravaganza expected to draw nearly 500,000 people, about a quarter of the country’s total population.
Latvia’s culture minister, Dace Melbarde, said the festival, which stretches back about 145 years, was about much more than singing and dancing. “It is about the awakening of the national consciousness in the 19th century that set the framework to become a nation,” she said.
That this year’s festival fell on the 100th anniversary of the nation’s founding has given more resonance to what is already a deeply emotional event. Even when Latvia was occupied by foreign powers and not allowed to fly its flag, the tradition continued.
The festival culminates with a final concert, described as “a cosmic journey through destiny, history, nature and family that ends with a return home along the Milky Way,” and the singing of “Gaismas pils,” the song about the magic castle.
In conversations with dozens of people at the festival and around Riga, worries about NATO were not the top concern, but there was a nagging sense that the world was off-kilter and the guarantees of recent years might not be as solid as they once seemed.
Edgars Vilumsons, 29, has grown so used to Russian provocations that he sees them as part of the background noise of daily life.
“It’s like if your neighbor had a mean dog and every day you walk past that dog but all it does is bark,” he said. “You are not going to stop what you are doing.”
His 85-year-old grandmother, he said, was not as sanguine. She often talks of being caught between Russian and German artillery fire, which destroyed the family home. After the annexation of Crimea, which shook Latvia, the theoretical seemed possible. Mr. Trump has suggested that he might be open to recognizing Russia’s annexation of Crimea, which the international community uniformly condemned as an act of blatant aggression.
Ms. Melbarde, still a bit bleary eyed from singing until dawn, said that one had to understand Latvia’s ethnic makeup and generational divide to understand its anxiety.
Most of the ethnic Russians arrived after the war, when the country was under Soviet domination. They have long been educated in separate schools and formed different social bonds as the nation has struggled to integrate them into society.
But the assimilation process has been made harder by increasingly aggressive propaganda campaigns in the Russian-language news media, narratives widely believed to be directed from Moscow with the intent of heightening divisions.
For example, Ms. Melbarde said, an annual summer festival based on ancient pagan traditions celebrating nature was portrayed as something sinister. “They reported that a bunch of neo-Nazis got together in the woods and set fires,” she said.
Ms. Melbarde said that more work needed to be done to combat the disinformation flowing to Russian speakers. NATO’s new strategic communication center in Latvia provided crucial help in fighting false and malicious narratives, she said.
Her hope is that in the near future, Russian speakers will feel that they can be proud of their ethnic identity but also feel a shared sense of national identity.
Indeed, research conducted by the Latvian government indicates that many younger ethnic Russians are willing to see themselves as Latvian.
The government hopes to capitalize on that sense by starting to integrate the schools, a move that failed in 2003 because of political opposition but that was recently approved by the legislature.
Anastasia Stankevich, 18, said that prospect terrified people like her parents, who are afraid that their children will forget their culture in Latvian schools.
Ms. Stankevich, who is deciding whether to attend college outside Latvia, said she shared the ambivalence of many Russian speakers.
“I feel a bit different than the Latvians,” she said. “We like different jokes.”
They also celebrate different holidays, including one that deeply divides the country: May 9. For Russian speakers, that was the day that World War II ended and is a cause for celebration. For Latvians, it was the day the occupation started.
Russia has never acknowledged itself as an occupying force, and lawmakers in Moscow passed a law specifically stating that Latvia’s being a part of the Soviet Union was justified by international law.
“On this day, I read the Latvian news and see one thing and then read the Russian news and see something totally different,” Ms. Stankevich said.
She said she understood the different perspective and just wanted to live in a country “where everyone respects each other’s culture.”