JAKARTA, Indonesia — The recent escape of four foreign inmates who tunneled their way out of Kerobokan Prison, a high-security facility on the Indonesian resort island of Bali, could have been a scene from a Hollywood movie.

But there is plenty of other drama within the walls of the prison — just a stone’s throw from some of Asia’s most exclusive beach resorts — and in many of Indonesia’s hundreds of other penitentiaries.

Prisons are overcrowded and have far too few guards. Corrupt staff members provide wealthier inmates with drugs, outings and even prostitutes, say analysts who have studied the corrections system. And guards have been accused of complicity in some escapes and incompetence in others, including the one at Kerobokan, which has become the latest symbol of the system’s many woes.

“It sadly does reflect the dysfunction,” said Leopold Sudaryono, an Indonesian doctoral scholar in criminology at Australian National University.