It all started when a British producer proposed a project with four films made by four different directors, all touching upon the topic of apocalypse. For about a month, director Andrey Zvyagintsev and screenwriter Oleg Negin looked for a plot and found "two or three curious concepts," but then Negin phoned Zvyagintsev one night and suggested they should meet. At the meeting, he told Zvyagintsev almost the complete plot of the future film. The story is based on an incident from Negin's life.
The film was originally planned to be made in English, with Elena, Vladimir and Sergey called Helen, Richard and Dan, respectively. Andrey Zvyagintsev dropped the idea when he realized working with an English producer meant "overcoming the issues of the creative method, of the language of cinema." Soon he proposed the script to Alexander Rodnyansky and the next day after Rodnyansky read it, he phoned Zvyagintsev and said, "Let's start." Zvyagintsev thanked Rodnyansky in a later interview for sharing his views.
Andrey Zvyagintsev usually doesn't let his actors read the script before filming but he gave it to Andrey Smirnov when he offered Smirnov the role of Vladimir. At first Smirnov, himself a director, had no intention to act in the film and warned Zvyagintsev during the casting that he couldn't interrupt the editing process of Zhila-byla odna baba (2011), his first film in over 30 years. Zvyagintsev came to Smirnov's place about a month after the casting in order to try to persuade him to star and Smirnov said it was out of the question as he was too busy editing his film, but his wife and son, who were at home too, lashed out at Smirnov, saying he couldn't refuse an offer from a director like Zvyagintsev. The latter promised to adjust the filming schedule for Smirnov. In the end, Smirnov filmed his role when he had days off in April 2010 and managed to devote two weeks to filming in May.
Discussing which profession Vladimir could have had in the past, Andrey Zvyagintsev and Andrey Smirnov presupposed an elderly rich man from today's Russia could have been a security officer from the KGB, or a functionary of Komsomol (the youth division of the Soviet communist party), or a scientist who went into business after the Soviet Union collapse. They decided Vladimir should be a scientist because Smirnov didn't look like the other two types. Despite the character's status, Smirnov considered him "an a**hole".