In “Bernie,” a new black comedy from “Slacker” and “School of Rock” director Richard Linklater, Jack Black plays Bernie Tiede, a closeted gay man who works at a small-town Texas funeral home and directs plays at the local college. Shirley MacLaine is a domineering, hateful, very wealthy widow who becomes involved in a hard-to-define relationship with Bernie that ends when he shoots her in the back. Matthew McConaughey is the district attorney who wants to put Bernie behind bars, but has a tough time because everyone in town thinks Bernie is too nice to have committed the murder, even though he confessed.

Some of the film’s most surprising performances come from the townspeople of Carthage, Texas, where the real-life story played out. Some of those “townspeople” are actors, and everyone’s lines are scripted, though the content was culled from actual interviews. But the method lends a documentary-like realness to Linklater’s illustration of life in a small town — and sheds light on why Tiede manages to remain so beloved after the incident.

“I had that idea from the outline stage,” says Linklater. “I kind of lean towards unconventional storytelling methods.”

Linklater also felt that the townspeople were the only ones who could effectively tell the story, since its two major characters weren’t around. (Tiede was sentenced in 1997 to life in prison.) “Neither of them are talking, so this thing was defined by what everyone else was saying,” he says. “I just thought, I’ve never seen a movie with a small-town gossip circle showing it like it is.”

The director became interested in the story as it was unfolding in real time and actually attended parts of Tiede’s trial. “I was gauging him,” he says. “Was he a charming psychopath, or the nice guy he says he is?” Linklater and Black also visited Tiede in jail to get a handle on the character.

“There’s a kind of killer that society needs to be protected from, and then there’s a kind of killer who’s very unlikely to do it again,” says Linklater. “And Bernie is definitely the second kind.”