At the gates of the city’s largest cemetery, a feverish 34-year-old Fidel Castro was rallying rifle-toting militiamen to battle. It was April 16, 1961. The Bay of Pigs invasion was underway. The Americans were behind it.

“What they will never forgive us for,” Castro roared, “is that we have made a socialist revolution right under their noses!”

Here was Castro’s political confession. Generations of Cuban schoolchildren would memorize the event as the “Declaration of the Socialist Character of the Revolution.” Until that moment Castro had insisted to his country, and suspicious U.S. officials, that his revolution was a nationalist one. Not anymore.

“Fidel!” the militiamen shouted. “Khrushchev! We’re with you!”

Almost 54 years after that turn toward Nikita Khrushchev’s Soviet Union, Cuba is at another defining moment. With its state-run economic model exhausted, U.S. relations on the mend and the long Castro era coming to a close, a subtle shift is underway to once more make Cuban nationalism the meaning of its revolution. Younger generations of Cubans will have to decide if they believe that.

At Manuel Valdes Rodriguez Municipal Primary School in Havana, Cristian Gongora, 10, shows salutes the flag after singing the national anthem before going to his classroom. (Sarah L. Voisin/The Washington Post)

The revolution’s many detractors say it has been little more than a ruse for the Castros to remain in power. If so, they are nearly out of time. Fidel is 88 and too frail to appear in public. His brother, Raúl, is 83, and says he will step down in 2018, leaving him three years to redefine Cuba’s relationship with the United States and hand off an economic and political system capable of enduring beyond the brothers’ rule.

They have long depicted their revolution as an evolutionary process, not something that ended with guerrilla victory in 1959. They also insisted that Cubans be for it or against it, and two generations later, this has produced a kind of collective revulsion at politics.

“C’mon, man, don’t ask me about that,” said one 23-year-old computer engineering graduate, selling phone cards in the street. He said he was too fearful to give his name to a foreign reporter. “I’m just trying to survive.”

In the years before failing health forced Fidel Castro aside, when he was still buoyed from the Elián González saga, the nation’s leader declared a “battle of ideas” in a last-ditch effort to rescue younger Cubans from the ideological contamination they had incurred in the post-Soviet austerity period. He wanted to warn them against the temptations of capitalism, individualism and materialism. It was too late.

Cuba today is a place where many young people idolize the United States and display little patience for the state-run economic model that has left much of their country in ruins. There is no stigma anymore toward entrepreneurship or private business. Real estate agents in Havana’s newly liberalized housing market signal high quality with the phrase “construción capitalista,” meaning a property that was built in the pre-Revolutionary period, when people cared about aesthetics and workmanship.

Indeed, nearly everything beautiful about Cuban architecture comes from this era, and the more that communist authorities had to promote the island’s attractions for its tourism industry, the more Cubans themselves began to internalize their “capitalist” heritage as a better time.

In the Raúl Castro era, Cuba’s revolutionary politics have receded. Gone is the constant churn of rallies and marches denouncing “the Empire.” There is no spellbinding leader speaking for hours on end.

Ask young Cubans today what the purpose of the revolution was, and chances are they’ll say free health care and education. Canada has that, too, of course, as do plenty of other liberal democracies whose citizens enjoy far more freedom and prosperity.

Few Cubans think they have anything to lose by economic liberalization, or that Cuba could stop being a place where people look out for their neighbors, help strangers in the streets and live without fear of gangs or criminals. They do not see a trade-off or worry that Cuba will end up more like Mexico or the Dominican Republic than Miami.

“We have no alternative to opening up to private enterprise,” said Roberto Veiga, a founder of the civil society group Cuba Posible, which advocates gradual reform. “But the younger generations don’t see a risk to the sense of equality and dignity that are positive achievements of the revolution.”

Since taking over for his brother in 2006, Raúl Castro has allowed Cubans to travel abroad, buy and sell their homes and run small businesses. The purpose of these liberalization measures — “updates” is the official term — is for more socialism, he insists, not less, and state-run companies will remain the core of Cuba’s model.

This increasingly hybrid economy is evident at the very Havana intersection where Fidel Castro stamped “socialism” on the revolution in 1961. All the main commercial spaces belong to the government, but private entrepreneurs work the margins, selling shoes, hot churros and pirated copies of rapper Pitbull videos and “The Hangover.”

Cuba’s updated version of socialism is one that eagerly partners with foreign capitalists to run heavy industries and all- ­inclusive tourist resorts. It is building luxury hotels and golf courses with Chinese bankers. It appears ready to roll out a red carpet for U.S. businesses willing to help break the trade embargo.

But with every tentative turn toward market economics, Cuban socialism becomes slipperier, less coherent, sending believers in the revolution looking for meaning elsewhere. Some appear to be turning back to the same Cuban nationalism Castro offered long ago.

It’s an interpretation of the revolution that reaches back to Cuba’s founding as a nation, and the bitterness left by the 1898 Spanish-American War, whose very name left Cubans out after their excruciating three-decade fight for independence. The ­United States kept Guantanamo Bay, and for decades afterward it reserved the right to intervene on the island at its whim.

Castro’s revolution, in this version, was the event that truly fulfilled the wishes of independence hero José Martí and ended U.S. domination of the island.

In a ceremony loaded with symbolism and broadcast live on national television on Feb. 24, the anniversary of the day Martí launched his 1895 uprising against Spain, Raúl Castro pinned medals on the five Cuban intelligence agents — the “Cuban Five” — who returned in the prisoner swap at the center of the agreement with President Obama. The men were declared “Heroes of the Republic.”

Gerardo Hernandez, the group’s ringleader, told Cubans their mission “was not over.” Cuba’s new relationship with the United States would usher in an era of change that required a renewed patriotic commitment, he said. “There are, and will be, many ways to defend Cuba, and Cuba will always need loyal sons to look out for her,” Hernandez said.

Raúl Castro did not speak. In his place, City Historian Eusebio Leal gave a long lesson in Cuban history, from the country’s origins to its colonial domination by Spain and the 19th-century patriots who rose up to fight for independence, forging a sense of nationhood despite their differences. It was a sweeping, slow- ­building speech, and at the end, Leal said Cuba had come to a new crossroads in its history, confronted by “a gentlemanly adversary who has lowered his aggressive posture, at least for a moment, giving us the opportunity to debate what we obviously need to debate at length.”

“What we need now more than ever is national unity,” he said.

On government calendars and stationery, 2015 is “Year 57 of the Revolution,” and that too is a milestone of sorts.

The period between Cuba’s founding as a republic in 1902 and the Castros’ rebel victory — the country’s entire pre-Castro history — spans just 56 years and seven months. By the next Jan. 1 anniversary of their revolution, they will have been in power even longer.

Read more:

Havana, from on high

Is Cuba on the verge of major political reform?

In Cuba, a long-forgotten landmark of U.S. culture