"Bates Motel" showrunner Kerry Ehrin discusses diverging from Hitchcock, avoiding transphobic narratives, and the fate of Marion Crane.

[Editor’s Note: The following interview contains spoilers for “Bates Motel” Season 5, Episode 6, “Marion.”]

It all seemed so familiar: Marion Crane checked into the Bates Motel. Norman brought her some food. She ate. They talked. Soon after, she climbed into the shower. Water poured from the faucet above. Tension slowly built. Then, suddenly, the curtain was yanked back, and…

“Screw this shit.”

With those words, Marion Crane stepped out of the shower and “Bates Motel” took its “Psycho” plot in a whole new direction. Rather than killing off the woman who stole from her employer in the hopes of starting a new life with her boyfriend — like in Alfred Hitchcock’s iconic film that inspired the series — showrunner Kerry Ehrin orchestrated a story that ended with Marion’s cheating beau, Sam Loomis, stabbed to death instead.

“That made me laugh, when she gets out of the shower,” Ehrin said, following a recent early screening of the episode. “That’s one of my favorite moments.”

READ MORE: ‘Bates Motel’ Review: Season 5 Does Right By Alfred Hitchcock By Ditching His Original Ending

Played by Rihanna over a two-episode arc, Marion survived in the end so she could start over as an independent thief on the run, while Sam (Austin Nichols) got what had been coming to him all season. Swapping the victim was something the writers planned out for a long time, with Ehrin telling Nichols early on he’d be the one to die in the shower in one of their first discussions.

“He was excited,” Ehrin said. “We talked a lot in the writers’ room about how to make bringing ‘Psycho’ into ‘Bates Motel’ meaningful, instead of just being like, ‘Hey, we’re doing “Psycho.”‘ [We wanted] to tell a different story than the woman being the victim.”

While the shower scenes featured a number of direct references to “Psycho” — including the water pouring directly into camera, Norman ripping back the curtain, and Loomis skillfully recreating Janet Leigh’s iconic face-first fall out of the tub — Ehrin and director Phil Abraham didn’t want to let the homages overwhelm the show’s ongoing narrative.

“We’re gonna have a little bit of ‘Psycho’ in here so it’s recognizable, but we’re also going to make it our own,” Ehrin said. “We’re going to put things in that you’re not expecting, so it doesn’t just become a frame-by-frame [remake.]”

Thematically, Ehrin was also very conscious not to reinforce a transphobic narrative — an accusation attached to “Psycho” because of how it demonizes a man when he identifies as a woman. In the film, Norman is dressed as his mother when he kills people, including Marion. Because Norman himself is innocent when identifying as a cisgender male and murderous when he identifies as a woman, one could argue “Psycho” propagates fear of trans individuals and supports a heteronormative viewpoint.

But in “Bates Motel,” Norman kills Sam as Norman. Though he’s become his mother before committing murder in the past, he’s not Norma when he pulls back the shower curtain.

“We wanted to be very careful about it,” Ehrin said. “In none of our minds is that what the story is about. It’s about a kid who very specifically thinks he’s his mother, as opposed to anything else. It really became about protecting that and not letting it slip or slide into anything transphobic.

“We kind of refigured the ending to make it more from Norman’s point of view, in the editing, because it really felt like you needed to be with him from when he was with [Norma] to when he made the decision to when he walked into the room. You had to be with him for it to have emotional resonance.”

Shortly before Norman kills Sam, he has a frank conversation with his mother. Norman has recently realized she’s not real (Norma died at the end of Season 4), but he’s struggling to get rid of her. She keeps talking to him, and, in order to rile him up so he’ll do what she wants, Norma tells him about his father.

“In the scene with Norma before he kills Sam, we’re bringing him back to his childhood,” Ehrin said. “She says, ‘This is why you made me up: to protect from these things you don’t want to experience or feel.’ What comes out of that is this rage that’s a combination of clarity and further insanity. Sam just becomes a stand-in for his dad.”

READ MORE: ‘Orphan Black’ Cast and Crew Share 14 Secrets of the Sestrahood — PaleyFest 2017

So with Sam dead and Marion alive, is there a chance we’ll see more of the iconic character?

“After this episode, no, she’s gone,” Ehrin said. “[The effects of her story] will linger on, obviously, because shit has happened. But we were lucky we got [Rihanna] as long as we did. She was great.”

With only four episodes left before “Bates Motel” closes for good, Ehrin teased how this episode sets up the series finale.

“This really positions Norman for the run to the end,” Ehrin said. “It’s going to be a lot about him, mother, and control — the bottom falling out of things and people circling back in.”

People, that is, who aren’t Marion Crane.

“Bates Motel” airs new episodes on Mondays at 10 p.m. on A&E.

Stay on top of the latest TV news! Sign up for our TV email newsletter here.

Sign Up: Stay on top of the latest breaking film and TV news! Sign up for our Email Newsletters here.