'Becoming Astrid' (Unga Astrid) by Danish filmmaker Pernille Fischer Christensen exposes the little-known backstory behind one of the world's most enduring girl characters, with her gravity-defying red plaits, abundant freckles and superhuman strength.
While still a teenager in conservative Sweden in the 1920s, the then Astrid Ericsson had an affair with her boss, the married editor-in-chief of the local newspaper, and fell pregnant.
The film examines the wrenching choices she was forced to make as a result, and the life lessons she drew.
“What happened here in this story made Astrid a really, really strong person,” Fischer Christensen said. “One of the things she might have learned from this is you have to think for yourself.
“(Englightenment philosopher Immanuel) Kant also said this but Astrid Lindgren says these things in a very, very simple way that just enters you when you are a child.”
Fischer Christensen, 48, who called Lindgren “one of the most innovative and influential artists of our time”, said Lindgren and her characters set an example for generations of people.
“I would not be the same person if I had not had Pippi,” she said.
The movie, which drew enthusiastic applause and a lot of tears at a press preview, introduces Astrid as a teenager living on her family's farm in a close-knit but judgemental tiny community.
Taken with her writing talent and independent streak, the editor, Blomberg, offers her a job but quickly falls in love with her and they begin a discreet affair.
When she becomes pregnant, Blomberg insists he wants to marry her, but his wife refuses to give him a divorce and threatens to press adultery charges.
Meanwhile the parents' land in the southern province of Småland belongs to the Protestant church, leading them to fear they could be cast out if Astrid's out-of-wedlock pregnancy comes to light.
She flees to Copenhagen to give birth to her son, Lasse, in secrecy, and then bids a painful goodbye to him as she leaves him with a Danish foster mother, Marie.
The separation is agonising for Astrid, and although she makes frequent visits, the toddler calls Marie “Mama” when he begins to speak.
But when Marie falls ill, Astrid has to take custody of three-year-old Lasse as a single mother struggling to get by in Stockholm on a secretary's salary.
After Lasse contracts whooping cough while Astrid is trying to juggle motherhood and her full-time job, the film imagines that she begins to invent fanciful tales to comfort him.
The bedtime stories, telling of people who only drink soda and say “good morning” to each other all day long, form the foundation of the massive body of work about Pippi, among the most translated books in children's literature.
As told in the film, based in part on a groundbreaking 2015 biography by Jens Andersen, Astrid's traumatic experience left its scars.
But it also liberated her from many of the oppressive conventions of her time, making her an early trailblazer for gender equality.
Only decades after she became a literary superstar and a national icon, in the 1970s, did Lindgren first tell the story to a female journalist.
Danish actress Alba August, daughter of Oscar-winning director Bille August, said she was drawn to the role of Astrid because she was a “rebel”.
“To start with she was just a role model for every girl her age where she lived,” she said.
“And she ended up being a hero in Sweden and a mom to every child in the world — a very powerful, brave and sensitive woman who affected all of us who have read her books.”
Lindgren only began writing down the tales in the 1940s, during World War II, and they were first published in 1945.
They were revolutionary not only for their female protagonist, but also for insisting that children and their concerns should be taken seriously, the director said.
The film begins and ends with Lindgren as an old woman, opening sacks of hand-drawn birthday cards sent to her from children around the world.
She died in 2002 in Stockholm, almost a complete century after her birth.
“Becoming Astrid” is screening in the Special sidebar section of the Berlinale, which runs until Sunday.