Kevin Alejandro revealed that the cast and crew scrambled to find a good story for the Season 5 finale after Netflix renewed "Lucifer" for a sixth and final season.

The actor, who plays Detective Daniel Espinoza and who directed the Season 5 finale, said that the renewal threw everyone "for a loop." They did not expect to get another season so everyone gave all that they've got into the finale, thinking it was the show's final run.

"All of us went into it, and continued throughout the journey, up until the episode before the last one, thinking this was our series finale. That this [season five] was the show finale," Alejandro told Metro UK adding, "You can tell, I think, just even through the scripts and through the episodes that they didn't hold anything back, they were just pushing forward."

He said that "everyone was under that impression until a couple of months before we ended the season and Netflix changed their minds." They had to find ways to make Season 6 even possible.

"We were like, 'shoot, where do we go from here? We've already invested, we've thrown every freaking trick in the book towards ending the show and trying to give everyone the kind of ending that it deserves. Where do we go from here? How do we?' But obviously we're all super, super excited, just surprised," Alejandro continued.

In the end, the writers had to make some major last-minute changes to the Season 5 finale of "Lucifer." The actor did not say what these tweaks are but assured viewers that it is going to be worth it.

"Having conversations with the writers now, or how they're going to bring it back to season six, you know they had to make some tweaks to our season finale," Alejandro explained adding "I didn't think they could. I think they didn't think they could do it, but lo and behold, they figured out a really cool way to excel through season six."

The cast and crew have yet to finish filming "Lucifer" Season 5 Episode 16, which is the finale. Tom Ellis hinted in a previous interview that production will resume in September. Netflix has also yet to announce the release of Season 5B after 5A arrived on Aug. 21.

Tom Ellis as Lucifer Morningstar Lucifer/Fox