But in central Beijing's halls of power, Cuba is perhaps seen these days as something less romantic: a market for China's booming private-sector exports.

Viewed from the world's largest communist country, Fidel Castro's death is a reminder of how the communist axis has changed beyond recognition since the ideologically charged era when the bearded revolutionary cut a dashing figure on the world stage alongside leaders like Mao Zedong.

After establishing diplomatic relations in 1960, the countries' fortunes diverged over the ensuing decades: China began adopting free-market reforms in the 1980s and morphed into an economic powerhouse — Communist mostly in name — while Castro persisted with Marxism, Cuba's economy hobbling on under U.S. sanctions.

Today, the two countries' leaders frequently nod to their shared ideological history, but bilateral relations revolve more around jointly developed beach resorts or Chinese telecoms investments. In a September visit, Chinese Premier Li Keqiang offered to support Cuba's development as a "comrade and brother," while Castro congratulated China on the growth it has achieved and sought assistance in agricultural technology.

At around $2.2 billion a year, trade between the two countries is dwarfed by China's commerce with the rest of Latin America, which totals $236 billion, according to Chinese state media. But China is Cuba's top creditor and second-largest trading partner after Venezuela, and ties have deepened swiftly.

Chinese refrigerators are found in Cuban homes, China's "Yutong" brand buses ply Cuba's highways and Chinese Unionpay cards are accepted at Cuban ATMs. In December, Air China launched a direct flight from Beijing to Havana largely to serve burgeoning Chinese tourists looking to spend holidays in the island nation.

"After China deepened reform and opened up in early 1990s, the development of bilateral ties between China and Cuba did not focus too much on ideology," said Zhu Feng, dean of the Institute of International Studies at Nanjing University. "Economic development and cooperation, which were beneficial to economic and social development in both countries, became more important."

Geopolitical tectonics have realigned in other ways since Castro's prime. Cuba restored diplomatic relations with the United States last year after a half-century freeze, a rapprochement that China viewed warily. Meanwhile, Washington lifted an arms embargo against Vietnam, another erstwhile communist enemy, and has backed Hanoi in maritime disputes against neighboring China.

North Korea remains a communist holdout, but the country's leader, Kim Jong Un, has increasingly exasperated China, which is collaborating with the United States to try to halt its erstwhile ally's nuclear program.

Shi Yinhong, a professor of international relations at Renmin University in Beijing, said the 90-year-old Castro's death had been anticipated and there will be no material change in China-Cuba relations, given that he relinquished power to his brother Raul years ago.

Still, Castro's passing is being mourned with a deep and genuine sense of nostalgia in China, even if he feels like an icon from a bygone era.

Chinese President Xi Jinping sent a telegram to Cuba on Saturday mourning the loss of a "dear comrade and true friend" of the Chinese people who made "immortal contributions to the development of socialism around the world."

Chinese state television rolled out hours of historical footage. Voiceovers highlighted Castro's cigar-chomping charisma, ideological conviction and seeming "invincibility," while denouncing U.S. intelligence operations against him and crippling U.S. sanctions against his country.

China's official Xinhua News Agency, meanwhile, eulogized a man who "resisted the American superpower for half a century" with the headline: "Old Soldiers Never Die."

From Jiang Zemin to Xi, who frequently reaches for Marxist-Leninist symbolism and language, generations of Chinese leaders have displayed an affinity for the distant ally at a personal level. Xi made a visit to Cuba in 2014 and, as he told an audience last year, sipped a mojito at Ernest Hemingway's favored bar.

Castro, likewise, was always greeted warmly in Beijing, and many older Chinese remember the 1995 visit when, decked in his tell-tale green fatigues, he stepped up to Mao's memorial in Tiananmen Square and snapped a military salute. Even in his later years, Castro was pictured wrapping Chinese leaders in bear hugs, eliciting surprise and delight from his hosts.

In the alleyways near Beijing's glittering World Trade Center complex, not far from Cartier and Versace boutiques, elderly residents on Saturday pondered the legacy of a man who loomed large in their youths.

"He was a good person," said a 78-year-old retired railway worker surnamed Zhang. "Cuba is our friend. I still remember joining the anti-U.S. parade to support Cuba in my 20s. The sugar we had was from Cuba."

Liang Yongxing, 60-year-old retired civil servant, said he was astonished by the news of Castro's death, calling it a momentous occasion for the international order.

"Aside from North Korea, I think he was the last person who clung to pure socialism," he said.