Many years ago in Agrabah, a young Jafar is treated brutally by a vicious blacksmith. A mysterious woman known as Amara walks through the local marketplace. All of the locals fear her. Jafar is ordered to look away, but he locks eyes with Amara instead. Later, he shows up at her house. He wants her to teach him dark magic. He seeks revenge on his father, the Sultan, who abandoned him. Amara agrees to take young Jafar under her wing.
A grown up Jafar gives a good man, Akil, the reward of some wine for saving his goat. He goes inside hoping to study the spells inside Amara's book. He's not ready yet. Instead, Amara wants to teach him another spell. They need a human liver first. They'll soon have one. The wine Jafar gave Akil is poisoned. Jafar must choose between saving his friend's life with the antidote or letting him die to learn the spell. Amara lets her pupil know that he needs to be like a serpent. He must shed his skin to be reborn. Jafar proves he is willing to do whatever it takes to get what he wants. He sets down the antidote and shares a kiss with Amara.
Amara finally shares the secret of her mysterious book. It's all about genies. Now that she has a partner, she can finally create a spell that will allow them to change the very laws of magic. Only the power of the three genies can make the spell happen. In the present, we see that Jafar has two genie bottles in his possession. He needs one more. In the past, we see how Jafar tortured a man to get a genie bottle. Amara then turned the man to stone. Jafar learns that the third genie is in Agrabah. He gives Amara a potion that transfers her magical essence to him before transforming her into a serpent that becomes the staff he carries with him today.
In the present, Jafar orders the Red Queen to eliminate the Knave of Hearts now that he's served his purpose of bringing Alice back to Wonderland. Out in the woods, the Knave wants to use the fact that the White Rabbit doesn't know he and Alice are savvy to him being a spy to their advantage. Their conversation gets put on hold when they are chased by two of the Caterpillar's collectors. The Knave takes off to draw them away from Alice. The guards are neutralized in an instant. The Knave believes Alice is the one who took them down. She wasn't. It was the Red Queen, who now stands before her past love, Will.
The Red Queen locks the Knave in her dungeon. Out in the woods, a lady collector known as Lizard lets Alice know that her friend has been captured. The two of them head off to find the Red Queen, who is struggling with Jafar's desire to have her prisoner executed. Alice learns that the Knave helped Lizard in the past. She finds out that the real reason he left Wonderland was because it reminded him of Anastasia. Will has a chance to leave again. The Red Queen says the White Rabbit will take him away. The Knave won't go. Instead, he dares her to kill him. Alice is shocked to see a sign advertising the public execution of the Knave. Today!
There's a catapult set up in the execution area. Whoever catches the Knave's head wins a free dinner. The Red Queen steps onto her balcony as her subjects cheer below. She learns that Alice is somewhere in the courtyard. Jafar wants to see how far she is willing to go. The Knave is brought before the queen. His head is put on the chopping block. The hooded executioner is ready to strike, and strike she does. The Knave is cut free from his bindings as the masked figure lashes out at the queen's guards. It's Alice! She and the Knave use the catapult to launch themselves to safety. There will be no execution this day.
Lizard leads Alice and the Knave through the courtyard maze, but they end up being trapped. Jafar chokes the Knave. He wants Alice to make a wish. The Knave fights for his life. Alice has no choice. She says, "I wish that if the Knave of Hearts dies, then I die." With that, Jafar releases his prisoner. That's one wish down, two to go. Jafar needs Alice alive, but doesn't need her in one piece. His infliction of pain doesn't work, so Jafar turns the Knave to stone. He knows Alice has a weakness. She cares. Jafar intends to exploit that.
Cyrus convinces a guard to give him a nibble of food. Actually, he gets a bone. More accurately, it's a wishbone. SNAP! Cyrus breaks the bone in two. He's caught shaping a key by another guard, who tosses the item into the abyss below his cage. Cyrus later realizes that a wish has been used. Jafar lets him know that he will soon be back in his bottle. Cyrus later reveals to his fellow prisoner that he still has the smaller half of the wishbone. He magically reunites it with the other half to begin cutting through his cage. He hopes to soon be reunited with his other half, a girl named Alice.