Logan is the conclusion Hugh-Jackman-as-Wolverine’s story deserves, and it’s one that fans of the character have been waiting for for quite a while. The other two solo Wolverine movies weren’t exactly well-received, although one could make an argument for the quality of 2013’s The Wolverine — you know, the one where he goes to Japan. As it turns out, the emotional, heartwrenching ending of Logan had been planned out ever since one key scene in The Wolverine. [The rest of this post contains SPOILERS for Logan — as in, I am going to tell you the ending. So if you haven’t seen it and don’t want to know, do not keep reading.]

In The Wolverine, Logan meets Yukio (Rila Fukishima), who has the ability to see how any specific person is going to die. She tells Wolverine that she’s seen his death, and describes it to him:

It’s not like I get a complete picture, more like looking through a keyhole. But I’m always right. All I can see is one part of a person’s life, their death. And I saw yours. I see you on your back, there’s blood everywhere. You’re holding your own heart in your hand. It’s not beating.

This scene was later shown in the movie in a literal sense: near the climax, Logan performs surgery on himself to remove a robotic parasite from his heart that’s been suppressing his healing factor. He recovers, of course, and fights the Silver Samurai, so it appears that Yukio had been wrong.

But that wouldn’t make any sense. Why have Yukio be wrong? As it turns out, she wasn’t, her words were just more of a metaphor. A Twitter user outlined it for director James Mangold here:

That second shot is, obviously, from the end of Logan, where, as he’s dying, Wolverine takes his daughter Laura’s hand in his. The ending works because it fits with the tone of the rest of the movie, but knowing what we know now, it works doubly well as a fulfillment of Yukio’s initial prophecy. Logan’s heart just turned out to be something else.

More From ScreenCrush