Above: Horses feed near the Alamar coastline; the city’s signature buildings can be seen in the distance. (Photo by Lisette Poole for The Washington Post)

“It was a model city,” said Román Pérez, 76, a retired bus driver who lives in Zone 8, block D52, apartment 21. He helped build D52 and two others with his own hands, as a member of a communist worker “micro-brigade.” This was Fidel Castro’s idea.

“We had everything then,” Pérez said. “Everyone looked after each other.”

That was 40 years ago. Today, with U.S.-Cuban relations on the mend, this island has come to the edge of a new post-Castro era. The country’s ideological foundations are cracking, and new uncertainties are coming — perhaps none larger than whether the egalitarian values of Castro’s revolution will be swept away by rising inequalities and the breakdown of Cuba’s socialist welfare state.

Communist Party elders want to keep a lid on market forces, but with every incremental opening, yawning income gaps emerge. The owner of a small private restaurant can earn hundreds of dollars a day, or more, in a country where three-quarters of the labor force works for the state and the average government salary is $20 a month. Tour guides and hotel chambermaids make more than scientists and doctors.

Younger Cubans do not seem too troubled. But these disparities, authorities fear, bear the seeds of social tensions, resentments and crime.

“Men Die, But the Party Is Immortal,” says a billboard in Alamar, trying to reassure residents who may wonder what will happen after Fidel, 89, and current President Raúl Castro, 84, are no longer around.

Cuba remains a society of unusual social and economic parity in Latin America, a region beset by deep class divisions and the world’s worst homicide rates. A fraying system of cradle-to-grave benefits keeps Cubans living in a kind of state-administered, socialized poverty, earning high scores on U.N. human development surveys but little for Cuban wallets.

[Facing new test, Cuba’s revolution circles back]

On the surface, Alamar looks like the kind of peripheral urban slum that a visitor would not dare enter in Sao Paulo or Bogota or Mexico City. Yet it is a place with no gangs, and essentially no guns or drugs, where neighbors know each other and parents send children out to play in the cracked stairwells and weedy lots. Social and economic equality — and political conformity — have been reinforced by the monotony of the architecture.

Old-timers such as Román Pérez say they would not want to live elsewhere. But most of the other members of Pérez’s micro-brigade have died or moved away. Their children are impatient to get out of Alamar, to somewhere better.

They see Cuba’s model city, and the country’s revolution, as running on fumes.