Warning: This article contains spoilers from the entirety ofLuciferseason 5B.

Kevin Alejandro’s Detective Dan Espinoza has taken quite the journey onLucifer.

(Meanwhile, Alejandro stepped behind the camera to direct in seasons 3 and 5.)

Lucifer

Kevin Alejandro on ‘Lucifer’.Netflix

Unfortunately, Dan’s time on this Earth finally came to an end in season 5.

Below, Alejandro opens up about his death scene, returning for season 6, and more.

When did you find out?

Lucifer

Kevin Alejandro on ‘Lucifer’.John P. Fleenor/Netflix

And so, that was the mentality we had going into it.

The audience is really starting to like Dan, really starting to understand who he is.

And they may have already had that idea and that helped them move forward with it.

Or I might’ve had a little bit of influence on what they thought should happen as well.

So I think it was a collaborative decision, in my opinion, as to what happened to Dan.

But it wasn’t the end.

You’ve got one more season."

I’m like, “What?

We just killed me.

What the heck?”

And of course, I wanted to be there till the very end.

And luckily, they wanted me to be part of it as well.

So we figured out a pretty interesting way to bring him back in some capacity.

I was going to ask if you were going to be in season 6.

Not the way people expect.

Season 5 was Dan’s [ending], really.

That’s a journey.

He’s part of the world.

Yeah, it did feel right.

And it still feels right.

They’ve done a really elegant job of continuing to tell the story.

He’s gotten a real journey.

That’s one of the things I love about playing Dan is that you really watch him struggle.

We all have an internal struggle to do what’s right, and we all know what’s right.

We all know what’s wrong.

And sometimes we make hard decisions for good reasons that get different results.

It was always from, “This will help X, Y, or Z. Dammit.

It was the wrong choice.”

Knowing his death was coming, did you do anything specific to prepare?

Not like outright sort of preparation.

When it comes to something like that, it’s all those emotions that are coming into it.

We all felt the solemness of the day.

We felt the location that they chose was sort of a tomb-like atmosphere.

So that added to the weight of the situation as well.

Even though we’re acting, it happened in a real way.

Now production wrapped on the show almost a year after it was supposed.

What was your last day on set like?

The whole experience was one of those unexpected dreams comes true.