An adaptation of Irvine Welsh's novel, Filth - starring James McAvoy - is a sterling British comedy drama, Andrew writes...

Based on the book of the same name by Irvine Welsh, Jon S Baird's second feature film (after 2008's Cass) is a very Scottish beast, though not the side of the country the tourist board choose to dwell on. In a duality that Edinburgh doesn't want to shake off, it comes out the week before the (apparently pretty good) Proclaimers jukebox musical Sunshine On Leith hits cinemas.

This is not a film that shows Edinburgh as a picture postcard location. The opening shot at the castle is not about glamour, rather a statement of Robertson's self-belief. The city is overcast and grey, and occasionally (as with Trainspotting) doubled by Glasgow. Scotland here is a dour, bigoted, depraved, ambiguous, repressed and thoroughly entertaining place; a setting for a story of threatened masculinity, an anti-hero at his peak, and his ensuing decline. It starts off at the castle and heads downhill from there, because there is nowhere else to go. McAvoy is superb throughout, relishing the chance to play an extreme anti-hero (that he has you intrigued by and sympathetic towards Robertson at all is an impressive feat).

Baird's script, while taking some deviations from the deviations of Welsh's novel, teases you with both its irreverence and the possibility of change in its characters. This is a film that is very happy to be surreal, with Robertson regularly breaking the fourth wall and a delirious guest appearance from David Soul. As with Trainspotting, there's a vigour and swagger to the filmmaking, a frank and unflinching depiction of drug use, violence, erotic asphyxiation, and photocopied penises. There's some shock value to be had from this, and some gallows humour, but it's not something that is glorified.

Filth is comfortable with displaying really unpleasant people doing unpleasant things to each other, with the consequences stacking up as the film progresses. In the background of the plot is a racially-motivated murder investigation, but really this is about Robertson and his machinations. He states at the start of the film that these games are to ensure he gets a promotion, but he has many demons to overcome, and ultimately it is not - as The Great Gonzo would claim in the film Muppet Treasure Island – cool.

What initially makes Filth entertaining is the streak of pitch black comedy amidst the horror and depravity. It's reminiscent of The League Of Gentlemen in its blend of tones and genres, the glorious excess and sickness. Like many of the inhabitants of Royston Vasey, much of what Filth's characters are laughing at is based on their own inadequacies. It goes to some very tragic, occasionally unspoken places. The blanks are barely hinted at, only their ramifications are shown or mentioned, and this extends to the other characters affected by Robertson's behaviour.

While McAvoy is the focus, the supporting cast is immensely strong and very recognisable. We've got Kate Dickie, Iain De Caestecker, Imogen Poots and Martin Compston in small roles; Eddie Marsan, Jim Broadbent and Jamie Bell in larger supporting ones. Marsan continues to develop his comedy chops after The World's End, Broadbent's role harkens back to his days as part of Terry Gilliam's regular carnival of grotesques, and Bell's turn quietly reminds you of the time he oozed charisma opposite a lumpen Hayden Christensen in Jumper. Everyone is as realistic or as outlandish as the role requires, with some scene stealing work from Gary Lewis and John Sessions (the former as the older, dim avuncular policeman, the latter as Robertson's boss in the police and Masonic brethren).

Where it failed for me is somewhat intangible. The last act feels like it's initially stuttering, until it regains its previous confidence. The pacing is slightly off, as Robertson's problems catch up with him too quickly, culminating in a hasty big reveal. The film suggests such a moment for a long time, inviting you to guess, and when it comes it's slightly different from what I anticipated. Even so, it's almost glossed over, too economical with its storytelling when it needed just a bit longer to breathe. Despite this glitch, Filth soon regains its footing, briefly misdirecting you before combining comedy, tragedy and character perfectly.

Overall, Filth is a barnstorming piece of cinema, one that is worthy of the hype. Comparisons to the 1996 adaptation of Trainspotting are inevitable, and while you shouldn't go in expecting quite as successful a transition from page to screen, you'll recognise the tone and attitudes present in both works, and this marks Baird out as a talent to watch.

Also, based on this pattern, whatever Irvine Welsh novel gets adapted in 2030 is going to be an absolute belter.