“The Mole Agent” infiltrated a nursing home in Chile, and countless of hearts around the world including inside the film academy.

The moving documentary about an octogenarian hired as a rookie spy to investigate whether a client’s mother is suffering abuse in the facility is competing for an Oscar this Sunday, but director Maite Alberdi constantly doubted whether she would have enough for a movie.

“I think the main challenge was that we were walking on eggshells,” said Alberdi, who on one hand feared that her protagonist Sergio Chamy would get tired and resign, or that the home’s officials would discover that he was not just another tenant or that she was not actually filming a documentary about the life of the elderly, as she had told them. The director came in a few days before Chamy, and they both pretended the whole time that they didn’t know each other.

Alberdi, 38, spoke recently with The Associated Press about the risks and challenges of the the three-and-a-half month shoot, the use of humor to address issues as sensitive as loneliness and abandonment at the dusk of life, and how the experience affected her.

Answers have been edited for brevity and clarity.

AP: How did you come about with the idea for this documentary?

ALBERDI: It came from a different place, from the intention of filming a private detective and trying to understand why people investigate, what an infiltrator does, what is the life of a mole agent like. When I saw the case of the residence, I realized that it was a place where I could talk about other topics and where I could infiltrate myself as well to film without killing the detective’s investigation. A few weeks before starting, the agent who usually worked with (chief detective) Romulo Aitken broke his hip, so that’s why Romulo put an ad in the newspaper.

AP: The film shows Romulo interviewing different candidates. How did you know that Sergio was the one for the role?

ALBERDI: It was love at first sight. Deep down I saw it, I fell in love. It was a gut thing. He was spontaneous, charming, funny, intelligent, a man who spoke about emotions — in the first interview he said that he was a widower, he told what was happening. He immediately stood out.

AP: The lady for whom he was hired ends up being a much less relevant character. Was it ever frustrating not getting the story that you were looking for, or did you notice immediately that you had a bigger one?