The Kiev-raised, Berlin-based helmer-writer Sergei Loznitsa (“My Joy,” “In the Fog”) returns to the Cannes competition for the third time in a row with his latest feature, “A Gentle Creature.”

What inspired the storyline?

I was inspired by Dostoyevsky’s short story “Krotkaya” [“A Gentle Creature”]. It’s about a relationship between a torturer and his victim, who, in Dostoyevsky’s story, happen to be a husband and a wife. One could consider “A Gentle Creature” as a second part of a diptych [the first being “My Joy”]. My intention was to study the mythology of the Russian [ex-Soviet] society, the cultural context, the mentality of the people who inhabit this surreal territory.

You’ve mentioned before that your years traveling through provincial Russia while working for the St. Petersburg Documentary Studios inspired “My Joy.” Did those travels also influence “A Gentle Creature?”

Yes, of course. It [was] during these journeys that I felt the spirit of the country and of its people. It was a profound experience and it will stay with me forever, and will continue to inspire my work.

This is the second film [after “In the Fog”] that you’ve shot in Daugavpils and in the Latgale region of Latvia. What sort of energy do you find there?

This territory is close to the border with Russia. It’s a very interesting mix of characters and nationalities. There are a lot of ethnic Belorussians, Russians, Latvians, Lithuanians, Jews. … Very good for casting. Also, the landscapes are very similar to the ones in central Russia. There is a certain tension that always exists in the border territories. A certain savage spirit, which I find very fascinating.

Is it difficult to mix the amateur and professional actors?

The film is about a prison, and there is a prison in the city of Daugavpils where we were shooting. About 70% of people, who I cast for various parts in the film, have had direct experience of prison — either as inmates, or as guards, relatives of the criminals, etc. There was one gentleman who spent a total of 37 years in prison. He was one of the most polite, charming and enthusiastic actors on my set. We also cast some staff members from the prison itself. For example, all the prison guards in the film are played by real guards. Our main concern throughout the shoot was to keep the ex-convicts from different gangs and different “orders” apart, and not to put them in the same scene, in order to maintain the hierarchy. Otherwise, we were told, things could have gotten out of control.

Do you work on your fiction and documentary projects simultaneously? Do you have a preference between the two? And what’s next?

No preference. I’m passionate both about fiction and about documentary. And yes — I work all the time. The next fiction project is called “Donbass.” It’s a contemporary story taking place in Ukraine. If everything goes according to the plan, we begin the preparations in September or October.