The trials of Mel Gibson, whose rants to an ex-girlfriend were caught on tape last year, seem like a curious case of life imitating art in The Beaver, a blackly humorous tale of a middle aged man’s emotional breakdown. Hopefully, any lingering controversy won’t overshadow Jodie Foster’s third film behind the camera and her most assured effort to date.

Based on a script by Kyle Killen, the film sensitively deals with themes of mental illness, suicide and self-belief, plumbing some dark nooks of the humans psyche as the characters come to terms with their failings. Foster treads carefully around the thorny subject matter, tempering occasional sentimentality with spiky humour.

Her ensemble cast rises to the challenge magnificently, anchored by a mesmerising performance from Gibson who performs almost the entire film with a glove puppet on his hand, alternating between his character’s softly spoken voice and the guttural Cockney growl of the stuffed animal. In other hands — pun intended — the double act of man and critter would be preposterous but there is a fearlessness to Gibson’s portrayal that compels us to see the world through his weary eyes. What we see, we like very much.

Businessman Walter Black (Gibson) presides over a toy company that desperately needs one innovative product to revive its ailing fortunes. While the VP (Cherry Jones) holds the business together, Walter self-implodes with depression, making life unbearable for his wife Meredith (Jodie Foster) and sons Porter (Anton Yelchin) and Henry (Riley Thomas Stewart). Eventually, Meredith is forced to kick out her husband, hoping he will get professional help.

Following a failed suicide attempt, Walter returns to the homestead with a beaver glove puppet, through which he addresses the family as part of a bizarre form of therapy.

Porter is furious. “It takes you years to get him out of here then you let him come back the next night with a talking hamster!” he rages at his mother.

Meanwhile at school, Porter tries to impress the smartest girl in his class, Norah (Jennifer Lawrence).

The Beaver sounds ridiculous yet on the screen, Foster, Gibson and co make this dysfunctional family snapshot work surprisingly well. Killen’s script glitters with some lovely turns of phrase (“Walter’s depression is an ink that stains everything it touches”) and we come to invest almost as much emotion in the Beaver as Walter.

A tasteful sex scene, complete with the puppet in attendance, ends with the hilarious image of the Beaver gasping for breath in perfect time with Gibson.

Elizabeth Halsey (Cameron Diaz) is a booze-addled wreck in Bad Teacher, draining her drippy, rich boyfriend dry until he finally musters the courage to dump her. So she reluctantly returns to her teaching job at a high school run by Principal Wally Snur (John Michael Higgins). Rebuffing the advances of oafish PE master Russell Gettis (Jason Segel), Elizabeth sets her sights on handsome new teacher Scott Delacorte (Justin Timberlake), who has an expensive watch on his wrist.

Unthinkably, Scott resists her flirtations and begins a tender romance with the school’s prim teacher, Amy Squirrel (Lucy Punch). Elizabeth is used to getting her own way and she declares war on Amy.

Bad Teacher is a nice idea poorly executed, underpinned by a script with too few laughs and a heroine whose selfish escapades leave us without a single drop of sympathy. Diaz is a gifted comic actress but she is on a hiding to nothing here, never quite hitting the target with the lacklustre one-liners.