Warning: This article contains spoilers for Saint Maud.

While its first 82 minutes are hardly a film for weak-stomached viewers, Saint Maud saves its most searing turn for its final moments.

In the closing minutes of the A24 horror flick, the title character (played by Morfydd Clark) walks down to the beach, douses herself in chemicals, and lights herself on fire, self-immolating in her final test of devotion to God. That's how she perceives it, anyway, until the movie's very last seconds, when Maud's vision of her ascension to heaven gives way to fiery agony across a jolting, horrifying cut.

"The beach scene was kind of the same for ages," writer-director Rose Glass tells EW. "For a long time, I knew that was how the film was going to end. And the whole challenge of it, for me, was trying to get the audience to go there with her."

That was really the challenge of the film as a whole, Glass adds: to fully place viewers inside Maud's head and psychosis, and ensure they were "not just watching this weird girl from a distance doing weird stuff."

Like such psychological classics as Taxi Driver and Repulsion — both of which Glass cites as influences — Saint Maud pushes this concept to its limits. An intense final act ahead of the beach scene sees Maud confront her atheistic former patient Amanda (Jennifer Ehle), who tells her God isn't real before transforming into a demonic apparition, which Maud stabs to death in a delusional haze.

It may be a bridge too far for some audiences, but that ending, Clark says, was part of why the material so electrified her. "I got a call from my agent and she was very excited [about the script]," the actress recalls. "I was kind of like, 'Okay, I'll read it.' And she's like, 'I think you should read it today!'

"I went home and read it, and I'm not very good at reading; it usually takes me a while," she continues. "I read it the whole way through, and then threw my iPad down beside me and just stared at the ceiling. The effect of the ending was so huge, just on paper, that I was quite obsessed with it."

Glass was also careful to ensure Maud "never turned into just this mindless person," maintaining an internal logic within her break from reality.

"The moment just before Amanda transforms, to me, is the closest Maud comes to lucidity and realizing, for a moment, the reality of her situation," the filmmaker explains. "Her mind basically can't deal with it. And so, in my head anyway, she descends to a new layer of psychosis, and her brain is defending herself against the trauma of the reality that she's in. That's kind of what motivates the jump scare and Amanda suddenly being a demon. It's like, 'Oh, no, don't worry, God is real. This is a test of your faith.'"

And Glass is confident audiences can relate to what Maud is feeling, even in the final moments: "She's still being motivated by stuff that most of us can probably understand. She wants be seen and feel important."

Saint Maud is now available to stream on Epix.

Related content: