Terry Gilliam has brought to Cannes his long-gestated and epically delayed movie version of Miguel de Cervantes’ Don Quixote, a biblical ordeal of wrecked sets, collapsed funding and bad luck that has outlived two of the actors once cast – John Hurt and Jean Rochefort – and which has been attended by colossal legal acrimony and brinkmanship right up to the red-carpet steps themselves, as the former backer Paulo Branco sought to injunct its showing here as closing gala. A French court found against Branco last week, but its screening here has been prefaced by a solemn lawyerly announcement respecting Mr Branco’s future claims. It’s a backstory of enormous drama, well told in Keith Fulton and Louis Pepe’s documentary Lost in La Mancha, all the way back in 2002, when it looked as if Gilliam’s Quixote film, like Orson Welles’, would never be made.

Well, hooray for Gilliam’s energy and self-belief because now it has got made, co-scripted with Tony Grisoni, and although it doesn’t have the visually ambitious and even revolutionary style of Brazil and 12 Monkeys – nor the hard edge of my own favourite of his later films, Tideland from 2006 – it is a film of sweet gaiety and cheerful good nature, an interesting undertow of poignancy, and with a lovely leading turn from Jonathan Pryce as the chivalric legend himself and roistering action scenes pleasantly like Richard Lester’s Three Musketeers movies from the 1970s. It’s almost like a children’s movie, in fact – and there’s nothing wrong with that.

This is a film with a sentimental respect for its source material – but Gilliam has new and vigorous insights to offer. It’s as if he is politely waving away our obvious view that he is a Quixote figure tilting indefatigably at movie-business windmills. No, the key player here is Sancho Panza: the servant, the enabler, the rational sceptic whose detachment is faltering, the sorcerer’s apprentice who doesn’t realise that he is being inducted into a mysterious art of creative self-delusion.

As befits Cervantes’ daringly postmodern novel, in whose latter part Quixote is aware of being a famous figure because of the publication of the first part, Gilliam’s Quixote is multilayered. Adam Driver plays Toby, the arrogant and overpaid ad director who has been given the chance to make a feature and has opted for Don Quixote. We see him filming in Spain, shooting the giants/windmills scene and enduring those same nightmares of delay that famously tried Gilliam’s faith and have become mythic expressions of imagination and reality. The movie is being bankrolled by an obnoxious, racist businessman, played by Stellan Skarsgård, whose jaded wife, Jacqui (Olga Kurylenko), tries to seduce Toby. Skarsgård’s mogul is in hock to a sinister Russian oligarch, Alexei (Jordi Mollà), who has a huge castle and is given to throwing fancy-dress parties and staging various dramatic events.

The Man Who Killed Don Quixote.

But in the midst of his ennui and cynicism, Toby is suddenly galvanised: he chances upon a bootleg DVD of his first film: a lo-fi, black-and-white indie that was an adaptation of … Don Quixote. He remembers his passion and idealism, and how he used local non-professionals to make it. His star was a kindly old shoemaker, played by Jonathan Pryce. While shooting is on suspension, Toby journeys to the nearby village to discover what has happened to his old star, and is astonished to discover that the experience of that film completely unhinged the man – or rather it gave him an energy and passion that he never had before. He now believes that he is Don Quixote, striding around looking for worlds to conquer and wrongs to right, his overwhelming vocational energy carrying him along. The bewildered Toby, overstressed and not used to the blazing heat, starts to become his Sancho Panza, losing his grip on boring old reality.

It’s a nice premise – similar, perhaps, to Dennis Hopper’s 1971 cult film The Last Movie, about a film-shoot in Peru creating a new kind of ritualistic culture. Pryce has exactly the right daft pomposity and wide-eyed credulity, believing in his own publicity, his own mythology. Driver creates a pretty straightforward character, aggressive, sweary and without much in the way of nuance. As he starts to lose it, his arrogant Americanness starts to curdle and he begins to fantasise that Moroccan illegals are jihadi terrorists, and hallucinates a visit from the Spanish Inquisition (surely Gilliam was tempted to add a line on whether they were expected), antisemitic bigots whose prejudice affords Toby an insight into his own heatstruck paranoia. Joana Ribeiro is interesting as Angelica, herself ruined by being cast as a teenager in Toby’s movie, and who endured 10 long years of disillusionment in showbusiness before returning to her home town, where the poor shoemaker now thinks that she is his Dulcinea.

It may not be Gilliam’s masterpiece, but it is a movie with sprightliness, innocence and charm and it is a morale boost to anyone who cares about creativity that Gilliam has got the film made at all. His own intelligence and joy in his work shine out of every frame, and his individuality is a delight when so much of mainstream cinema seems to have been created by algorithm. What a dull place the world would be without Terry Gilliam.

