Gone Baby Gone is set in a tarnished working-class corner of Boston, not Praia da Luz, but its superficial similarities with the Madeleine McCann case - four-year-old Amanda McCready is stolen from her bed while alone in the house - were enough for it to be consigned to limbo by its distributor for six months. But this superb film, based on Dennis Lehane's novel, is more redolent of the recent disappearance of Shannon Matthews - or rather the smear campaign waged by the tabloids against the Matthews family for the unforgivable crime of being poor and uncouth.
Besides, the picture is not really about Amanda's kidnapping at all; that's just the catalyst for a rigorous argument, virtually extinct in Hollywood cinema since the 1970s, about the need to apply moral codes to a reality that stubbornly resists them. Two private detectives, Patrick Kenzie (Casey Affleck) and his girlfriend Angie Gennaro (Michelle Monaghan), are asked by Amanda's aunt Bea (Amy Madigan) to "augment the police investigation", as she puts it, in a way that suggests she's been up half the night rehearsing her spiel.
Her husband Lionel (Titus Welliver), who might have been named for his Lionel Jeffries-style moustache, points out that the parents of the child beauty pageant star JonBenét Ramsey also hired private eyes; he makes it sound like he's following kidnapping etiquette. Conversely, Amanda's mother, Helene (the note-perfect Amy Ryan), shows no sign of having consulted the handbook for distraught parents. She can blub on cue, but she's feisty and foul-mouthed. And also a promiscuous, heroin-smoking drug mule. And her roots are showing.
One of the bravest things about the film is how starkly it paints Helene, whose childcare skills are descended from King Herod, while still vehemently defending her right to be a mother. Children are conspicuous by their absence here - the daughter of the police captain (Morgan Freeman) was murdered; Bea is unable to conceive; Patrick and Angie seem to have chosen work over family. Yet it is Helene, whom Angie describes as "arsenic", who gets to have a child.
When it emerges that she used to take Amanda with her on long-distance drug-runs, Helene is unrepentant. "I don't got no daycare," she spits. "It's hard being a mother." Usually, on the rare occasions that working-class characters are depicted in US cinema, they are blessed with some celestial purity denied to those in higher income brackets (think of the poor-but-happy third-class passengers jigging their socks off in Titanic). Not here. Like Maggie Gyllenhaal's ex-con junkie mum in last year's SherryBaby, Helene isn't the salt of the earth - she's just salty.
But then few of the characters in Gone Baby Gone conform to convention. Take Patrick, a skinny guy with a big mouth: he delivers the hard-boiled voice-over that is the birthright of every cinematic private eye, but wears tracksuits and trainers rather than a Bogart suit and, even at 31, looks so young that you want to ground him whenever he says a naughty word.
The cops tell him to go back to his Harry Potter books, but his youthful swagger is an advantage; wading into a world where people are called things like Cheese, Skinny Ray and Big Dave, he cheerfully introduces himself as "Medium Patrick". And he was at school with Helene, which adds another kink to material that keeps straying from the beaten track.
With Gone Baby Gone, the actor-turned-director Ben Affleck (Casey's big brother) shows himself to be a confident, democratic film-maker. This first stint behind the camera eclipses anything he's done in front of it and makes him a contender for the "Do give up the day job" award. The narrative goes haywire in the last half-hour, with formerly sane people doing steadily more implausible things in order to act out the film's struggle between what's best and what's moral. But even this snarl-up of plot-points can be forgiven in the light of a subtly shocking final scene, one of the best endings in recent cinema, which socks you right between the eyes. I'm still reeling.
Pick of the week
Three reissues this week:
Let’s Get Lost (15)
dir: Bruce Weber
A stylish 1988 portrait of the jazz legend Chet Baker . . .
The Passionate Friends (PG)
dir: David Lean
. . . an obscure 1949 romance from the revered director . . .
Jules et Jim (PG)
dir: François Truffaut
. . . and the 1962 Nouvelle Vague classic with Jeanne Moreau.