But human rights groups say corruption and institutional disarray have stymied efforts to improve conditions in many prisons. The nation’s Institute for Penitentiary Studies has had about 1,200 graduates since the 1990s, but fewer than 30 of them work in prisons, depriving the system of professional guidance and expertise.

A series of inmate takeovers in recent weeks has underscored the troubles. In April, inmates outside Caracas took 22 officials hostage, including the warden, protesting a tuberculosis outbreak. The weeklong standoff ended when authorities agreed to replace the warden. In May, inmates at another prison took its warden and 14 employees hostage for 24 hours to protest what they called mistreatment.

“The state has lost control of the prisons in Venezuela,” said Carlos Nieto, director of Window to Freedom, which documents rights violations in Venezuelan prisons.

Image Life at San Antonio prison resembles Margarita's resorts. Credit... The New York Times

Luis Gutiérrez, the warden at San Antonio, refused to discuss the prison he nominally oversees. On weekends, the ambience inside, bursting with spouses, romantic partners and some who simply show up looking for diversion, almost resembles the island’s beach resorts.

Prisoners barbecue meat while sipping whisky poolside. In some cells, equipped with air-conditioning and DirecTV satellite dishes, inmates relax with wives or girlfriends. (Venezuela, like other Latin American countries, allows conjugal visits.) The children of some inmates swim in one of the prison’s four pools.

Prisoners boast that they built these perks themselves, with their own money. They say escapes are rare (inmates, if they try, still face the threat of being shot by soldiers outside). And while San Antonio can hardly be considered safe — a grenade attack in the infirmary killed several men last year — inmates argue that compared with other jails, peace often prevails.