On the one hand, Emin Alper burning days is a low-key but revealing account of the resurgence of homophobia – a key element of right-wing populism – in Turkey. On the other hand, it’s a half and half genre film: half thriller and half western.

In the Cannes Un Certain Regard entry, a conscientious prosecutor moves from the city to a small town, where he soon finds himself on the wrong side of the townspeople’s pitchforks. It’s Wyatt Earp, basically, except city boy Emre (Selahbattin Pasali) is the kind of public official whose integrity comes through doing the right thing. He’s also very neat, even when his water isn’t working. As is not often the case: more on this in a minute.

Emre is also clumsy, unable to find common ground with local bigwigs. A local election is looming; nevertheless, the mayor keeps inviting him to dinner, which his instinct tells him to avoid at all costs. When he succumbs, Mayor Sahin’s son (Erol Babaoglu) urges him to join the gang the next time the traveling brothel comes to town. Before that, they must go on a pig hunt! Worse still, doing things by the book doesn’t work here; it is a gift economy. Even a short walk down the main street means running the gauntlet of offered teacups, each with a bundle of strings attached.

In fact, only one thing really matters to people. It never rains in Yaniklar. An extended crane shot follows Emre’s car from above as it drives the main road into town. It cuts an endless desert in two. Most of the city’s water is siphoned off from the groundwater table, albeit intermittently and unreliably, which means most homes have hours or days without running water. The current mayor, the kind of tin potentate you can find in any country in the world, is betting his re-election on the promise of a bigger and better groundwater system. Anyone who can build a fountain will be mayor forever.

Opposite him are the naysayers pointing to the vast sinkholes that have begun to scar the surrounding country and have already engulfed a stable full of animals. The next one might eat a block. They offer to divert water from a distant river, but it’s more expensive, and dark forces stand against them anyway. Because it’s not just about bringing water to the city; it is also a war of ideologies and personalities: the worst kind. This war is about to land on Emre’s desk, as a family displaced by one of these new craters demands that those responsible be prosecuted.

It’s a convoluted backstory, full of administrative minutia, vaguely explained conspiracies, and legal proceedings that too often cloud the central storyline, which is about the rape of a local Roma girl, Peknez (Eylul Ersoz). Peknez’s learning difficulties and innocent penchant for partying make her an easy target for bullies. The same night Emre is finally persuaded to go to the mayor for dinner, Peknez shows up and starts dancing with Sahin and the local dentist, a giggling idiot named Kemal (Erdem Senocak). The next day, she is in the hospital, dizzy and bleeding.

What happened there, exactly? The raki was strong; Emre is not a heavy drinker. He knows he was sick and fell asleep on the mayor’s couch. Sahin and Kemal deny everything, but also hint that Emre woke up and “had fun too”. On the contrary, says their handsome neighbor Murat (Ekin Koc), who happens to be the editor of the local newspaper and leading the fight against the mayor over the water issue. He took Emre for the night. And now what? His table mates have already hinted that his sexuality is in question. Now they all think he’s mixed up with Murat. Maybe he is. For all he knows, he may be the rapist.

Alper’s plot often becomes entangled in its own complexities; he indulges in exposition and spectacle – because the desert, to be fair, gives cinematographer Christos Karamanis plenty of spectacular opportunities – and is so carefully vague about what may be a sexual relationship that you might blink and completely miss those hints. His director’s notes say there are also hints that Murat was a teenage hustler, but these are so subtle it’s likely a foreign audience would never notice them. Of course you know why. Alper wants Turkish audiences to see his film.

Where he is very good is on the miasma of corruption, compromise and concession that will soon permeate any body politic that is not subjected to intense scrutiny. A local vocabulary develops which softens all that is disagreeable; for Sahin and Kemal, “having fun” seems to cover all the bases. It is also the flag of modern values, of education against ignorance, of the cosmopolitan city against the kind of place where nobody wants anything to change.

This story can be told almost anywhere. burning days is considerably more restrained and serious than Issuance, but you wouldn’t be surprised if Sahin told Emre to squeal like a pig. Yanuklar is that kind of place.