Count Jan Potocki (1761-1815) was a Polish nobleman who fought at sea as a member of the Knights of Malta, traveled to Mongolia and carefully recorded what he saw there, and was the first Pole to fly in a balloon–just for starters. He became depressed in later life and retreated to his estate, where he wrote a massive novel, The Manuscript Found in Saragossa. Then, convinced he was turning into a werewolf, he committed suicide.

Well known to Poles, the novel was finally translated into English in 1995. Filmed as The Saragossa Manuscript in 1965 by director Wojciech Has, it attained cult status in the West despite releases that cut up to an hour from its 182-minute length. The film’s admirers included Luis Bunuel, David Lynch, and Jerry Garcia, who co-financed the present restoration, only to die a day after a shipment to the Pacific Film Archive in Berkeley turned out to contain the wrong version of the film.

That’s a twist that would have delighted Potocki, whose story is a strange mix of nested tales–madcap, sexy, and horrifying all at the same time. It contains aspects of Tristram Shandy, early occultism, the Thousand and One Nights, Don Quixote, and the Decameron, all without being really like any of those. The tale begins with a soldier in Napoleon’s time who finds an old manuscript in a house where he hides out in the midst of a battle. The manuscript turns out to contain writings and drawings by the soldier’s grandfather, a Walloon captain in Spain, and the film shifts to the grandfather’s perspective as he enters upon a series of adventures. He meets a pair of Moorish sisters who suggest that he marry them both but that to do so he has to convert to Islam. This may all be a dream–he keeps coming to in a sere hillside landscape next to a pair of hanged men, made spookier still by Krzysztof Penderecki’s all-percussion score.

As he tries to make his way to Madrid, the grandfather hears stories from others, who hear stories from others. There are, by my count, five layers in all, each filled with an interlocking cast of characters (the Moorish sisters, for example, return in various guises) and exuberant visual details like a skull goblet. The overall structure proceeds from serious and almost surrealistic elements to romantic comedy, as if to suggest a philosophical hierarchy with absurd humor at the transcendent top. You may lose track of the story as it proceeds, but don’t worry–the characters do too, and the whole collection of narratives is wrapped up in such a way as to leave the manuscript lying on the table where it was when the film began.

The Saragossa Manuscript comes to the Michigan Theater Monday, October 13, as part of the series Martin Scorsese Presents: Masterpieces of Polish Cinema.