he 71st Cannes Film Festival is underway (May 8-19), and L.A. Times critic Justin Chang is there, seeing as many movies as possible and writing about it for a day-by-day, film-by-film diary. This is one in a series of entries spanning from the opening festivities to closing night. For more entries and reviews, click here.

Closing-night films at festivals are often dismal, forgettable affairs, and Cannes’ track record has been no exception. (If you remember “Ice and the Sky” or have fond memories of “What Just Happened,” I stand corrected.) In the last two years, the festival has opted to forego an official closing-night film entirely, instead simply replaying the Palme d’Or-winning title after the awards ceremony.

And so there were reasons for the heart to sink at the news that “The Man Who Killed Don Quixote,” Terry Gilliam’s endlessly embattled, decades-in-the-making riff on the Miguel de Cervantes classic, had been selected to bring down the curtain on the 71st Festival de Cannes.

At the same time, the momentous nature of the occasion was cause for legitimate, if queasy, excitement. Even if the Curse of the Closing-Night Film persisted and the film turned out to be awful, surely the satisfaction of seeing Gilliam’s long-delayed dream project finally completed would provide a measure of catharsis, closure in more than one sense.

“[Don Quixote’s] been a pain in the ass for 25 years, and finally we’ve got him out of the system,” Gilliam said at a news conference Saturday afternoon. Also in attendance were stars Jonathan Pryce and Adam Driver, who play the film’s Don Quixote and Sancho Panza figures, respectively, and Gilliam’s co-writer, Tony Grisoni, who has been with the project since its aborted 1998-2000 production, which was supposed to star Jean Rochefort and Johnny Depp.

The failure of that attempt was expertly chronicled by Keith Fulton and Louis Pepe in their 2002 “unmaking-of” documentary, “Lost in La Mancha.” The new film is dedicated to the memory of the late Rochefort and John Hurt, both of whom were at different times tapped to play Quixote.

Pryce noted his delight at being reunited with Gilliam for a fourth time after “Brazil” (1985), “The Brothers Grimm” (2005) and “The Adventures of Baron Munchausen” (1988), a movie that ran into some budgetary and logistical woes of its own. He even joked that Gilliam had deliberately sabotaged his own production.

“He put a lot of obstacles in the way of ‘Quixote’ being made … to wait until I was old enough to play him,” he said.

It was a warm, positively feel-good reception for a film whose entry into the festival had been anything but smooth. In late April, the Portuguese producer Paulo Branco and his company, Alfama Films Production, filed a lawsuit claiming that Branco had been wrongly cut out as a producer on “The Man Who Killed Don Quixote” and seeking to block the Cannes screening of the film. The festival leapt to Gilliam’s defense, denouncing Branco for using “intimidation and defamatory statements” and stating it had every intention of screening the film as planned unless the court ruled otherwise.

In the end Branco’s lawsuit was dismissed, the screening allowed to proceed. But the drama wasn’t over yet. It was reported that Gilliam had been unable to appear in court due to a minor stroke, though the director has since clarified to the Guardian that it was a “perforated medullated artery,” calling it about as painful as a stubbed toe. And the day the festival began, the news broke that Amazon Studios, which had contributed significant funding to the project, had pulled out as its North American distributor.

By the time the movie finally arrived for its single Cannes press screening — in the Salle Bazin, one of the festival’s smaller theaters — some of us in the audience found ourselves torn between tempered excitement and mounting dread.

What else could go wrong? Would technical difficulties bring the projection to a halt? Would a meteorite strike the Salle Bazin mid-screening, as the Telegraph critic Robbie Collin predicted on Twitter? Would audience members inexplicably fall ill and have to be carried out on stretchers? The movie couldn’t be that bad, could it?

Adam Driver in the movie "The Man Who Killed Don Quixote." Diego Lopez Calvin

It’s a relief to be able to say: No, not that bad at all. Certainly it bears the scars of its troubled production quite visibly, even humorously. The screening began with a legally required title card acknowledging that the festival premiere did not in any way prejudice Branco’s rights in any ongoing action, followed by some sly introductory text (“And now … after more than 25 years in the making … and unmaking … ”). The movie then dumps us beside a windmill somewhere in Spain, where a cynical young director, Toby (Adam Driver), is shooting a TV commercial.

The meta-convolutions spiral outward from there. Ten years earlier, still flush with talent and idealism, Toby shot a black-and-white student film based on “Don Quixote” in a nearby village, with a local shoemaker, Javier (Jonathan Pryce), playing the Man of La Mancha himself. In a sly Cervantean twist, Javier has since gone mad and convinced himself that he really is Don Quixote.

Much fitfully amusing, carefully choreographed insanity ensues when Quixote mistakes Toby for Sancho and drags him along on a manic getaway. Also in the mix: Stellan Skarsgård as Toby’s dastardly boss, Olga Kurylenko as the boss’ vampy wife and Joana Ribeiro as a damsel in distress who becomes the focus of Javier’s chivalrous intent.

Make no mistake, “The Man Who Killed Don Quixote” is as volatile, frenzied and clogged with destructive incident as its difficult history might lead you to expect. Which is to say, it plays more or less like any Terry Gilliam movie, even the ones that didn’t face production woes comparable to the labors of Hercules.

To call the movie a mess would be to state the obvious and perhaps miss the point. The movie’s sense of moment-to-moment chaos — madcap scenes of bellowing, falling, tumbling and general agitating — is scarcely accidental. It is, on the contrary, very deliberately achieved.

At the press conference, Gilliam emphasized that he had done everything he could to economize, including eliminating an originally planned time-travel element and setting the film in the present day. He seemed both high-spirited and slightly dazed, reacting with some disbelief when a journalist at the conference congratulated him on having made “a masterpiece.”

“Are you talking about ‘Brazil’?” he said. “Wait, you’re talking about this film? It’s good?”

“The Man Who Killed Don Quixote” is no masterpiece, and its mixed critical reception so far suggests that for some, even “good” may be a stretch. What seems beyond denial is that it is an intensely personal piece of filmmaking, a movie shot through with sneaky, unruly pleasures and no small poignancy.

Again and again, we see not just Quixote but others falling blissfully, though also tragically, under the spell of some grand delusion. It’s a motif that almost certainly resonates with Gilliam, for whom the idea of ever seeing this project through to its completion must have struck others, and perhaps even himself, as a folly worthy of Quixote himself.

“It’s amazing how this film reflects reality,” he said, in the process giving the movie a fitting benediction. For now, against all odds and despite every attempt to kill it, this “Don Quixote” lives.

Terry Gilliam on the set of "The Man Who Killed Don Quixote." Diego Lopez Calvin

justin.chang@latimes.com