Ahsoka is a lead character in six of the seven seasons of The Clone Wars. She is a padawan-commander of the 501st Legion in the Grand Army of the Republic and continues to learn the ways of the Jedi as Anakin's apprentice. The two develop a mutual fondness, at times taking great risks to protect or save one another. Some of Anakin's actions taken out of concern for Ahsoka expose his darker tendencies, such as his torture of prisoners who may know her location when she goes missing. Ahsoka also finds mentorship from Captain Rex, a clone trooper with whom she and Anakin serve throughout the war. During the final arc of season five, Ahsoka is framed and imprisoned for a deadly explosion and a subsequent murder. Although eventually exonerated, she becomes disillusioned with the Jedi Council and leaves the Jedi Order in the season finale. Anakin is greatly affected by this ordeal and this begins to shake his trust in the Jedi Council. Filoni said an initial finale concept for The Clone Wars would have had Rex escape Order 66, and his and Ahsoka's presence elsewhere would have explained both characters' absence from Revenge of the Sith. Ahsoka returns in the seventh and final season of The Clone Wars, which aired in 2020 on Disney+. She is the focus of two of the three story arcs featured in the season. The second one, set during the events of Revenge of the Sith, sees her briefly reuniting with Anakin and acting as an advisor to Rex (promoted to Commander) in the 332nd Company (split from the 501st Legion) during the Siege of Mandalore to capture the former Sith Lord Maul. When she confronts Maul, he reveals that Darth Sidious intends to make Anakin his new apprentice and offers to join forces to prevent this, but she doesn't believe him and fights him. Ahsoka defeats and captures Maul, but as she is preparing to take him to Coruscant, she senses her former master in trouble, though is not actually aware that he has fallen to the dark side and helped kill Mace Windu. Order 66 is issued, causing Ahsoka's clone troopers, including Rex, to turn on her. She escapes and manages to remove Rex's chip controlling his brain, while also freeing Maul to create a distraction. When the Star Destroyer they are on crashes on a small moon, Ahsoka and Rex survive and bury all the deceased clone troopers, along with the former's lightsaber, before parting ways. The final scene of the series depicts Darth Vader leading a search on the planet and walking up to the remains of the ship. He notices Ahsoka's blade on the ground, picks it up, and ignites it. Vader then walks away with the saber, assuming that his former Padawan has perished.