For some 20 years, Jim Carrey has demonstrated range far beyond the slapstick comedic roles that first made him rich and famous.

Think of “The Truman Show” (1998), “The Majestic” (2001), “Eternal Sunshine of the Spotless Mind” (2004) and “The Number 23” (2007).
Rarely, though, has Carrey tackled anything as dour and dark and bleak as “Dark Crimes.”

This is a well-made, well-acted and sometimes intriguing but also coldly cynical and manipulative murder mystery.

This film also features a number of shock scenes in which women are brutalized and humiliated and demeaned. In some cases, it feels as if the depictions of exploitation are exploitative and gratuitous in and of themselves.

Almost unrecognizable beneath a bushy beard and delivering his lines in heavily accented English, Carrey turns in strong and haunting work as Tadek, a deeply troubled veteran Polish detective who seems to be on the OCD spectrum.

Tadek was once a candidate for chief of police, but he has been relegated to cold-case desk duty after he botched a high-profile investigation.

Still, Tadek has a squeaky-clean reputation and he still has friends on the force. With one year left on the job before he can retire, Tadek has been told to keep a low profile and make no waves — but he can’t let go of an unsolved case involving the murder of a well-known man named Daniel, who was a regular at an S&M club called The Cage.

(The opening scenes of “Dark Crimes” show graphic scenes of debauchery at The Cage. That’s disturbing enough — but later on, when a character uncovers videotapes from the now-shuttered sex clubs, we learn of even more depraved and sickening acts carried out by certain patrons.)

Tadek is convinced Daniel’s killer is the famous author Kozlow (Marton Csokas, effectively repulsive), whose latest work of fiction includes a description of a murder that sounds exactly like the murder of Daniel — and includes details known only to the police.

The novel was never published, but Tadek tracks down an audio version of the book that seems to incriminate the brilliant and arrogant Kozlow, who literally laughs in Tadek’s face when he’s brought in for questioning.

Kozlow works the system, charms the media and lies about being mistreated by Tadek while in custody. Convinced Kozlow is going to get away with murder, Tadek goes off the rails, risking his marriage and committing a number of crimes in a desperate attempt to prove Kozlow’s guilt.

Charlotte Gainsbourg (a wonderful actress) has a thankless role as Kozlow’s girlfriend, Kasia — a single mother and recovering addict who has been physically and emotionally abused by men too numerous to count. (The story arc between Tadek and Kasia stretches credulity and results in some of the more off-putting scenes in a film that’s never as involving as it should be.)

Director Alexandros Avranas films “Dark Crimes” in stark, hellish tones, accurately reflecting the nightmarish world of this story. The script by Jeremy Brock (“The Last King of Scotland”) is loosely based on a 2008 New Yorker story by David Grann about an actual case in which a Polish detective uncovered incriminating evidence in a true-crime novel.

Source material with great dramatic potential. Talented director and screenwriter. Intriguing cast.

That’s a promising menu — but the end product leaves a sour taste.

★★

Saban Films presents a film directed by Alexandros Avranas and written by Jeremy Brock. Rated R (for strong and disturbing violent/sexual content including rape, graphic nudity, and language). Running time: 92 minutes. Opens Friday at AMC Woodridge and on demand.