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

Lucifer's core cast lost one of its mainstays in Season 5B, with Det. Dan Espinoza being suddenly killed. However, Dan's actor Kevin Alejandro has assured fans that he'll be back for the show's sixth and final season.

Alejandro discussed his character's fate with Lucifer's showrunners and came to a solution that satisfied all of them, he explained in an interview with TVLine. Although Dan's death was originally Alejandro's own idea, he hadn't anticipated another season at the time, and he didn't want to miss out on so much of the show that he had been with since its beginning.

RELATED: Lucifer: God Is Just the WORST

Asked about his reaction to the idea of the show continuing without Dan, Alejandro said, "Joe [Henderson] and Ildy [Modrovich] immediately got on the phone with me, to say, 'Hey, here’s the news. If you still want to be part of us, we know how to do it respectfully, and not change the quality of what we’re creating.'"

Although it's not yet known how Dan can return after his death, there are several doors open given the way that Lucifer incorporates the supernatural and the afterlife into its mythology. Furthermore, another twist in Dan's Season 5 arc revealed that he had gone to Hell rather than Heaven, which is a hanging thread that the next season is likely to explore.

RELATED: Lucifer's Season 5 Finale Has a Fitting Nod to The Good Place

"I wanted to be with these relationships and with these people to the very end, and now we weren’t anymore," Alejandro said. "And Joe and Ildy respected that, and thankfully they wanted me to be a part of it as well. So they found a gentle way to bring me back — not the way people are going to expect him to come back, and maybe not as a huge part of the show, but I got to be there for the end in some capacity. And that felt wonderful, to be able to finish out a full journey. Because dude, it’s been a journey, as you know."

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 Bosses Reveal How the Debbie Gibson Cameo Came About

Source: TVLine