JUST OUTSIDE SANTA CLARA, a city in central Cuba, in a hotel that was once a Communist Party hospitality centre, a trio of musicians entertains a large group of German tourists. The trio belts out “Hasta Siempre, Comandante”, an anthem to Che Guevara, whose capture of an armoured train at Santa Clara prompted the collapse of the Batista dictatorship. “I wouldn't sing this song for an audience of young Cubans. But it has international resonance,” explains one of the trio.

Then they strike up “Chan Chan” from the Buena Vista Social Club. That music is associated with the Batista years, consigning its elderly practitioners to neglect under communism until Ry Cooder, an American, turned them into international superstars in the late 1990s. In a confusion the government has happily exploited, they have become incongruous icons of the Cuban revolutionary myth.

That myth has been extraordinarily potent and durable. Along with Caribbean beaches and cheap rum, it draws tourists to Cuba (2.7m last year, a record). It has led the Latin American and European left to treat the Cuban dictatorship with indulgence. Soviet communism and its eastern European satellites never held any romantic appeal. Cuba was different. Two things of substance have sustained the myth—and the Castros' rule. First, even as he turned his country into a Soviet client, Fidel Castro managed to embody Cuban nationalism, as the David defying the American Goliath and its economic embargo. In the three decades from 1898 the United States all but ran Cuba, having ousted Spain. By the 1950s American businesses owned large, though diminishing, chunks of the island's economy. That brought resentment and economic distortions, but also investment and progress: in 1959 Cuba was one of the leading five Latin American countries on a range of socio-economic indicators. Life expectancy was close to that of the United States and it had more doctors per person than Britain and France. But around a third of the population lived in severe poverty.

The second substantial achievement was that even as he expropriated almost all private property, Fidel poured resources into social programmes that reached from cradle to grave, providing free world-class health care and education as well as free pensions and funerals. Child malnutrition and adult illiteracy were eliminated. Life expectancy and many other social indicators rose above those of the United States. Every Cuban household had (and still has) a ration book (or libreta) entitling it to a monthly supply of food and other staples, provided at nominal cost. Many other services were (and are) similarly subsidised. Compared with the rest of Latin America, Cuba seemed to be achieving greater racial and sexual equality.

Fidel's defiance of the United States and Cuba's social achievements under his rule found many admirers abroad. They also secured the more or less enthusiastic support for the regime of a majority of Cubans. The deal was that Fidel would give them security and meet their basic needs, and in return they would surrender their liberty. Many of those who rejected that deal emigrated, often with official encouragement. Others were jailed, often in appalling conditions, by Fidel's police state.

The wages of poverty

That deal began to break down in the Special Period. When Soviet subsidies suddenly dried up, Cuba's fiscal deficit soared, to a peak of 33% of GDP. The government covered the gap by printing money, which stoked inflation. In real terms the average wage has dropped to just 25% of its value in 1989. A survey in Havana in 2000 found that 20% of the population was poor (defined as “at risk of being unable to satisfy their basic needs”); the national figure now is almost certainly higher.

Social services have suffered, too. According to a paper by Carmelo Mesa Lago, a Cuban economist at the University of Pittsburgh, and Pavel Vidal, an economist at Havana University's Centre for the Study of the Cuban Economy (CEEC), in 1989 Cuba outranked every other Latin American country in all social indicators except housing. But between 1989 and 1993 social spending per head was slashed by 78% in real terms. It has since recovered somewhat, but the paternalistic state is fraying.

Hurricane damage in 2008 added to an already acute housing shortage. Contrary to the myth, Cuba now has some shanty towns. Just off the main avenue in Miramar, a plush part of Havana studded with foreign embassies and homes of senior party officials, stands El Romerio, an enclave of tightly packed huts of corrugated iron and wood. On a Saturday afternoon its mainly black residents play dominos in the narrow, rutted streets. Decades of migration to the capital from the poorer east have turned the century-old houses of central Havana into overcrowded slums. In January four young people died after a house collapsed. People still live in the crumbling house next door.

Transport has long been scarce. There are only 600,000 cars on the island, with an average age of 15 years, and half of them belong to the state. A new fleet of Chinese buses helped, but Cuba failed to include their maintenance in the contract and some are already off the road, according to a foreign diplomat. The government also paid over the odds for the diesel generators that have temporarily eased the chronic power cuts.

Cuba still stands out from its neighbours in two respects. First, its extraordinarily effective civil-defence system has ensured that the frequent hurricanes rarely cause as much loss of life as they do elsewhere in the Caribbean (or the United States). Secondly, violent crime is rare: a visitor can walk through the roughest parts of Havana with little fear. But both these achievements are those of authoritarian rule.

And now health services and education are becoming harder to access and getting worse. Secondary-school enrolment is below its 1989 peak. There is a surfeit of humanities graduates and a shortage of agronomists and engineers. Although infant mortality has continued to fall, maternal mortality has risen. Many drugs are in short supply. Hospital patients sometimes have to bring their own sheets. There are reports of doctors starting to demand payment. On a weekday morning in a village in the inappropriately named municipality of La Salud (“health”), south of the capital, this correspondent came across an elderly woman who had hurt her arm and was whimpering with pain, having found no doctors in attendance at two health clinics.

In 2010, 37,000 Cuban doctors and other health workers were working in 77 countries around the world, mostly in Venezuela but also in Africa, the Caribbean and Central America. The Cuban government also offers scholarships to 20,000 Latin Americans to study medicine—all part of its obsessive search for international prestige. But the main reason for the shortage of medical staff is low salaries. A woman who gave her name as Grisel says she worked as a family doctor for just $23 a month, but now earns $40 a month in an improvised craft shop in Havana. She has two small children. A pair of children's shoes costs $13. As a doctor “I faced a choice of buying shoes or eating.”

Raúl Castro has taken steps to rationalise health and education services and has raised teachers' salaries. But the crucial reform required to make the welfare state sustainable is to switch from subsidising products and services indiscriminately to subsidising those people who need it, and Raúl has shrunk from that. His proposal to phase out the libreta was removed from the guidelines at the party congress.

Inequality revisited

Cuba's growing social inequalities are symbolised by the dual currency system introduced in the Special Period. The “convertible peso”, or CUC, is now fixed at par to the dollar. The ordinary Cuban peso is theoretically worth the same as the CUC, but that is an accounting fiction. In fact the peso is pegged at 24 to the CUC. The CUC is used for foreign trade and tourism. Wages and the prices of basic goods in the domestic economy are set in pesos. The average monthly wage is 454 pesos, or $19.

The shelves of state-owned shops selling merchandise in pesos are sparsely stocked. Many things, from white goods to processed foods, can be bought only with CUCs, so many professionals are working in the tourist industry or in foreign-owned companies. Remittances from family members abroad have added another source of inequality. So has a large informal economy. And now private business is doing its bit.

In all this Cuba is starting to resemble the rest of Latin America, but without political liberties. The Gini coefficient of income inequality (where 0 represents complete equality and 1 complete inequality) rose from 0.24 in the late 1980s to 0.41 a decade later, according to research quoted in Espacio Laical, a magazine published by Cuba's Catholic church. A confidential later study is said to have put the figure at 0.5, similar to the Latin American average of 0.53 in the mid-2000s.

Cuba has no visible oligarchs as yet, but it does have a number of increasingly wealthy people. They include farmers, owners of some tourist-linked businesses such as guest houses and restaurants, and some officials who profit from their contacts. The Castro brothers themselves have always lived simply, but “Habana Libre”, a recently published book about the lifestyles of the city's privileged caste of artists and musicians, included photographs of sons of Fidel and Che Guevara.

Cubans are extraordinarily resilient, adaptable people, but their frustration is palpable. On being asked to take his passenger to a restaurant owned by Roberto Robaina, a former foreign minister, a taxi driver exploded: “These people spend their whole time stopping us from getting ahead, and they are helping themselves.” Resentment at the unfair advantages enjoyed by the party elite is echoed by Roberto Pérez (not his real name), a 50-year-old sports instructor living in Santa Clara: “The problem is that people who work hard and obey the law don't get ahead. It's those at the top who get ahead by doing business with foreigners.”

In much of Cuba it has become hard to find anyone under 40 with a good word to say for the system. Mr Pérez's son, a teacher, plans to leave Cuba as soon as he can. “The young people here have nothing to do. They are desperate,” says his father. That is why the economic reforms have to succeed.