Star Wars: The Rise of Skywalker ends in a predictably almighty battle between Jedi and Sith, and the fate of the galaxy is at stake; here's exactly how the long-awaited fight ends. The Rise of Skywalker reveals Palpatine as the final boss of the Star Wars sequel trilogy, and the entire Skywalker saga, with the Emperor seeking to possess Rey's body and rule the galaxy with the spirits of the Sith living eternally inside her. Unfortunately for Palpatine, the villain has underestimated the strength of the bond between Kylo Ren and Rey, as well as the influence of a dying Leia to inspire the redemption of her son.

Spurring each other on to fight for the light side, Kylo Ren and Rey join forces and confront Palpatine for one last battle between good and evil, but in doing so, Palpatine learns that he can use the energy of the Reylo dyad to revive his own frail body, rendering his entire previous plan unnecessary. With Rey and Ben Solo having served their purpose and firmly aligned to the Jedi side of the Force equation, the final battle of The Rise of Skywalker pits Palpatine against Rey and Ben. After using an almighty Force push to hurl Ben away, Rey is left to face her grandfather one-on-one in a struggle to end 4 decades of Star Wars.

Related: Kylo Ren Visited Mustafa In Rise Of Skywalker (But You Probably Missed It)

Palpatine deploys his Force lightning, which Rey manages to repel with her own lightsaber (the Skywalker saber previously belonging to Luke and Anakin) before adding Leia's weapon to the mix, dual-wielding against the oncoming rush of blue energy bolts from her opponent's fingers. Faced against the might of the Emperor, who had already used his lightning to attack the Resistance ships battling above, Rey is straining and begins to repeat the phrase "be with me" to herself.

Daisy Ridley as Rey in Star Wars The Rise of Skywalker and Ian McDiarmid as Emperor Palpatine Darth Sidious

This is a callback to Rey's training with Leia during the The Rise of Skywalker's opening moments. Rey was using the mantra while meditating and mentally lifting rocks, but was seemingly having no success reaching out to whomever she was trying to contact. When she tries again during the fight against Palpatine, the ghosts of deceased Jedi respond, including Anakin Skywalker, Qui-Gon Jinn, Mace Windu and Ahsoka Tano, as well as her own previous master, Luke Skywalker. Not only do these spiritual voices speak words of encouragement to Rey, but it's implied that they channel their own power into her when Palpatine claims that all the Sith live within him and Rey retorts that all of the Jedi live on in her.

This development means The Rise of Skywalker's final battle is now the collected power of the Sith, acting through Palpatine, against the collected power of the Jedi, channeled through Rey, in a final battle to determine which side is stronger. The light/dark side balance first introduced in 1977 is represented via these two figures and, naturally, the good guys win out in the end. Rey is able to force back Palpatine's lightning, disintegrating the Emperor into atoms and (probably) leaving no chance of resurrection. Tragically, the exertion involved in defeating Palpatine seems to take Rey's life, similar to how Luke Skywalker sacrificed himself by projecting a Force image onto Crait in The Last Jedi. In a final act of redemption, Ben Solo clambers out of the chasm he was sent down and transfers his own life force into Rey, reviving her at his own expense.

More: Star Wars: Where Is Ben's Force Ghost In The Rise Of Skywalker?