Traditionally, boxing is the way out of the ghetto, or the way into a central core of toxic masculinity – and then redemptively out of it. In this movie, it is the route to a safer, fractionally more prestigious, marginally less violent part of a Thai jail: the Klong Prem central prison in Bangkok. This is the true story of Billy Moore, a guy from Liverpool who got involved in drugs and burglary, tried to restart his life in Thailand as a boxer and stuntman, but was arrested there in 2005 for gun offences and sentenced to three years in this authentically terrifying place. He earned respect for mastering Muay Thai boxing, and was finally released in a royal amnesty in 2010 to serve the rest of his term in the UK. He was convicted again this summer for burglary.

This film has been adapted by screenwriters Jonathan Hirschbein and Nick Saltrese from the memoir Moore published about his experiences, and directed by Jean-Stéphane Sauvaire, who made the comparably grisly child-soldier drama Johnny Mad Dog in 2008. Billy is played by Joe Cole from TV’s Peaky Blinders, and his weirdly cherubic face of almost choirboy innocence hardens into a mask of rage and fear. Vithaya Pansringarm (who was the cop in Nicolas Winding Refn’s Only God Forgives) plays the prison warden.

This is visceral, often unwatchably brutal stuff: a moment-by-moment depiction of an unspeakable ordeal. Watching it feels pretty much like having your intestines wrenched out of your eye sockets, especially in one unbearable scene: in a sweatily crowded cell, tattooed gangsters rape a prisoner for Billy’s benefit, as an evil demonstration of power.

For non-Thai-speaking audiences, it is also claustrophobic because the dialogue is unsubtitled, thus putting us right inside the prison house of Billy’s mind. As warders bark orders and fellow prisoners scream at him, or at each other around him, Billy is terrified, bewildered. He has only a basic knowledge of what is going on. But a basic knowledge is all he needs, because the power relations are themselves so basic. Tellingly, it is almost an hour and a half into the film before we hear a sentence in English, when a worried doctor tells Billy some very bad news.

At any one time, a sinister shuffling choreography is being acted out. Like figures in a Hieronymus Bosch painting, the sweating, half-naked prisoners will swarm up to Billy, or away from him; they will cuff him, slap him and jostle him, maybe to punish him, maybe to get his attention, maybe to mime what they want him to do. Sometimes they will yell and sometimes burst out into aggressive and unreadable laughter, mocking whatever baffled response Billy has tried to improvise to get them to go away. Finally, Billy persuades a trainer to let him box and his talent gets him a ticket out of the grim overcrowded area and into the cushier “boxing” cells. But the wiseguys will want a cut of whatever gambling winnings they assume Billy gets, and his addiction and health get steadily worse.

The spectacle being offered up in A Prayer Before Dawn is part of a well-established tradition, challenging or troubling according to viewpoint. You could find it in Alan Parker’s Midnight Express, or even David Lean’s Bridge on the River Kwai – the spectacle of the white man in a foreign jail, his white body in fierce contrast to everything around him; his unclothed state, designed of course to subject and humiliate, is even more conspicuous. Perhaps he is innocent, or perhaps he is guilty, but that is not even the point. His foreignness or otherness is part of the ordeal, and the cruel-and-unusual quality of this foreignness is part of the dramatic impact: a doubling of imprisonment. Yet I never felt the Thai characters being patronised by the film; there is a tough respect in the training scenes.

It is perhaps foolish to compliment a film on being “real” if you have no independent knowledge of what that reality is, but A Prayer Before Dawn really did seem overwhelmingly real, and the fight sequences themselves are terrifically shot. In boxing movies, what happens in the ring is a metaphorical extension of what’s happening outside it. Here, there’s nothing metaphorical about it. Violence is all around. It’s a film of teeth-rattling ferocity.