Robert Carlyle's Directorial Debut to Open Edinburgh International Film Festival

Jack Rowand/ABC

His black comedy, 'The Legend of Barney Thomson,' stars 'Once Upon a Time's' Mr. Gold himself alongside Emma Thompson and Ray Winstone.

BAFTA-winning Scottish actor Robert Carlyle, who rose to fame with Trainspotting and went on to star in The Full Monty, The World Is Not Enough and 28 Weeks Later before appearing as Mr. Gold/Rumpelstiltskin on ABC's hit series Once Upon a Time, will see his first turn as a feature-film director open this year's Edinburgh International Film Festival.

The Legend of Barney Thomson, starring Emma Thompson, Ray Winstone and Carlyle, will kick off the event in the Scottish capital on June 17, organizers announced Tuesday.

A darkly humerous Glasgow-set thriller, the film is based on Douglas Lindsay's novel The Legend of Barney Thomson and tells the story of an awkward barber (Carlyle) who inadvertently stumbles into serial murder with both absurd and macabre consequences. Complicating matters further, Barney’s mother, Cemolina (Thompson), has a secret of her own, which causes a bloody and comedic chain of events. While Barney clumsily tries to cover his and his mother’s tracks, local police inspector Holdall (Winstone) fights his own battles within his inept homicide department as he tries to solve the crime of the century. A black comedy of errors unfolds as the police try to capture the murderer at large.

Tom Courtenay, Ashley Jensen, Martin Compston, Brian Pettifer, Kevin Guthrie, James Cosmo, Stephen McCole and Samuel Robertson also star, with a screenplay by Colin McLaren and Richard Cowan. The film will be released across the U.K. in June 2015 through Icon Film Distribution.

"After a careerlong association with EIFF, it gives me enormous pleasure to have The Legend of Barney Thomson chosen as opening-night film," said Carlyle. "It really is such an honor for me to have my first feature as director premiered here in Edinburgh at the festival that has played such a huge part in my life."

Mark Adams, the new artistic director of EIFF said: "We are thrilled to be opening this year’s festival with Robert Carlyle’s wonderful black comedy. It is a marvelously macabre and playful film, impressively directed and with a terrific cast. It is the perfect film to kick off what promises to be an exciting festival."