Early in Richard Linklater's cheerfully twisted true-crime Texas comedy, Bernie, a cartoon map appears with sections of the state broken down culturally, anthropologically. Sonny Davis, a colorful coot in a trucker cap, addresses the camera from his perch atop a diner stool, describing central Texas as the People's Republic of Austin, full of "hairy-legged women and liberal fruitcakes."

The northern part of the state, he continues, is where the "Dallas snobs with their Mercedes" reside. Houston is on "the carcinogenic coast."

And Carthage, the East Texas burg where our story takes place, sits along the Pine Curtain - "where the South begins."

"Truth be known," Davis adds, "it's a good place."

It's also the place where Bernard Tiede, a man with a trim mustache and a generous heart, shot and killed the rich and spiteful octogenarian Marjorie Nugent.

Known as Bernie to most everyone - and played with just the right combination of earnestness and quirk by Jack Black - he's a skilled mortician who sings in the church, leads the amateur theater troupe, and has a good word to say for everyone.

Even for Marjorie - a penny-pinching millionairess whom Bernie befriends, and then moves in with, becoming her personal assistant, her financial adviser, and her heir. Fiercely possessive, demanding, and jealous, Marjorie (a perfectly stony Shirley MacLaine) is everything Bernie is not. Still, the couple need each other, and their life together seems to work, even if Carthage tongues are wagging. (Are they sleeping together? Isn't Bernie gay?)

Linklater, a native Texan and an adventurous filmmaker (Me and Orson Welles, A Scanner Darkly, Before Sunrise, Dazed and Confused), has a field day with this oddball tale. Interspersing the narrative with gossipy, guileless commentary from real-life Carthaginians like the aforementioned Davis, he presents Bernie as an intensely likable figure. Bernie throws himself into his work at the funeral home, earning the respect of his boss and the thanks of the bereaved - whom he counsels and comforts with heartfelt brio.

Bernie, even as it is based on real events covered widely in the news - and in a Texas Monthly article, by Skip Hollandsworth, that serves as the basis for the film - constantly surprises. Yes, Bernie killed Marjorie. And yes, he confessed. But the townsfolk love him anyway and think he should be allowed to walk.

If anything, their outrage is reserved for the victim, a widow loathed even by members of her own family. The world is a better place without her.

Looking a little bit like Oliver Hardy and carrying himself with a spry bounce, Black makes Bernie impossible to dislike - he's sweet, he's smart, and he sings show tunes with wonderful panache.

It is left to the prosecuting attorney, a hard-charging law enforcer in a white cowboy hat - Danny Buck Davidson (another unexpectedly funny, focused performance, this one from Matthew McConaughey) - to bring Bernie to justice.

But is justice being served?

That's the question we're left pondering in this weirdly funny, inspiring film.