I first went looking for the film in 2010 because of its source material, the novel The Manuscript Found in Saragossa by Count Jan Potocki (1761-1815). The book bears some resemblance to works like the Arabian Nights or the Decameron. It's a fantasy (at least in part) describing the experiences and stories related to a young Walloon officer in the Sierra Morenas of Spain in 1739. It includes gypsies, cabbalists, Sapphic sister Moorish princesses, and hints at secret history. The stories are nested like Matryoshka dolls, with narrators of some stories showing up as characters in others. Neil Gaiman, a fan of the work, has called it "a labyrinth inside of a maze." It combines elements of the gothic and picaresque with eroticism and humor.
The book itself has an interesting history. It's so convoluted in fact that Potocki's authorship was at times doubted. The novel was written in French, and over an extended period in several stages. The first few "days" were published in 1805 in French. Later, the entire manuscript was translated and published in Polish, but then the original complete manuscript was lost, and had to be "back translated" into French for a complete French version. Wikipedia suggests that scholars now think their were two versions: an unfinished one from 1804, published in 1885, and a rewritten, tonal different complete 1810 version. Only the first of these versions has appeared in English, though both are available in French.
Potocki himself is an interesting and character. He was served as a military officer, and was also for a time of novice of the Knights of Malta. He traveled and wrote scholarly studies on linguistics and ethnography. In 1790, he was among the first to fly in a hot air balloon. He also committed suicide by shooting himself in the head. Allegedly, this was done with a silver bullet he fashioned himself and had had blessed by a chaplain!
Anyway the novel is well worth your time as is Has's film.