WARNING: The following contains major spoilers for Lucifer's Season 5B, streaming now on Netflix.

Dan needed to die so that Lucifer could believe in his higher power.

During an exclusive interview with CBR, Lucifer co-showrunner Joe Henderson revealed the real reason why Detective Dan Espinoza needed to die in the show's latest season. Henderson shared, "One, we wanted Chloe to feel guilt, and to feel like by stepping away someone had filled the void and taken her spot. Two, we wanted Lucifer to feel anger and pain."

RELATED: Lucifer Showrunner Explains the Fate of [SPOILER]

The Shadecraft writer continued, "For all of his two steps forward, we wanted him to take a step back and misinterpret and feel lost and feel the sense that the rules were wrong. That things aren't working. If someone like Dan Espinosa goes to hell, then then the world is broken, and give him an extra sort of sense of, 'Okay, well, if I'm God, how do I fix that?' That was really important to us [in the writers' room]. Because being God isn't easy and figuring out how to make these things work isn't easy. And, also life, isn't easy."

Ultimately, Det. Dan's death in 5B inspired Lucifer to see his future as God. While Lucifer never quite admitted it to himself while Dan was alive, he considered Dan to be one of his closest mortal friends. When asked about Dan's future in Season 6, Henderson teased the potential to see more of Dan, stating, "All I will say is we will continue that journey. And this is not the last we've seen of dealing with the repercussions of Detective Dan Espinoza's death."

RELATED: Netflix Releases Lucifer Season 5B's Opening Scene Online

Lucifer star Kevin Alejandro shared his thoughts on his characters' surprising death to ET, stating, "I was absolutely satisfied with what everyone decided to do, because it was just for story reasons and character arc, to where the audience is just getting to understand who this person is, and before they fully evolve, they're ripped out. I thought it was such a really good choice and strong storytelling on their part."

Lucifer stars Tom Ellis as Lucifer Morningstar, Lauren German as Det. Chloe Decker, D.B. Woodside as Amenadiel, Rachael Harris as Dr. Linda Martin, Kevin Alejandro as Det. Dan Espinoza, Lesley-Ann Brandt as Mazikeen Smith and Aimee Garcia as Ella Lopez. Season 5B is now on Netflix.

KEEP READING: Lucifer Declares Himself God in Season 5B Trailer

Source: ET