Based primarily on the real life of Dangoule Rasalaite, who ended up in Sweden after her mother took off and went to America. The film follows the events of Dangoule's life pretty closely, with the main exception of the boy Volodja who is entirely fictional.
The town in which Lilja lives, is in real life called Paldiski and is located in Estonia, not far from the capital Tallinn. The submarine base has now been destroyed. Some scenes are indeed shot in Paldiski, but many in Tallinn - in the districts of Kopli and Lasnamäe.