In Agrabah in the distant past, a young apprentice named Jafar is working at a blacksmith's shop in the marketplace. The man harangues him for running out of coal and threatens to throw Jafar out into the streets where he found him. As the young boy cowers in fear, a woman enters the marketplace and everyone else runs in terror. The woman, Amara, conjures a coin to pay for her goods, and Jafar stares at her rapt. He ignores the blacksmith's warnings to hide, and watches as the woman looks him over briefly and then walks away.
That night, Jafar goes to Amara's cottage outside of town and knocks at the door. She's surprised to see him and demands to know why he's there, and Jafar explains that he wants to learn dark magic so that people will fear him as they fear her. Amara refuses, saying that dark magic is for more than just scaring off bullies. Jafar says that he wants revenge, and finally admits that he hates the sultan--his father. The boy says that his father abandoned him in the streets because he was a bastard, and Amara says that now that Jafar has been honest, they can see what he will do.
In Wonderland, the Tweedles tend to the Red Queen as Jafar arrives. After she sends her servants away, Jafar tells his ally that they must have honesty between them, and wonders why she didn't tell him that she used the Knave to bring Alice back to Wonderland. The Red Queen says that the Knave is of no consequence and that she only needed someone that Alice trusted. Jafar agrees and tells her that now that the Knave has served his purpose, he can be eliminated.
After discovering that the White Rabbit gave Cyrus' bottle to the Red Queen, Alice storms off through the forest to find the Queen and confront her over the theft. The Knave, trailing along, suggests that they used their knowledge of the White Rabbit's betrayal to set a trap. Before they can discuss the matter further, the Caterpillar's "collectors' start scouring the forest for the Knave. Alice and the Knave hide but the collectors close in. The Knave offers to lead them off and runs away before Alice can stop him.
In Jafar's dungeon, Cyrus begs a drunken guard to throw him the chicken that he's eating. The guard, pleased to see the genie beg, tosses him the remains of the chicken and leaves. The old prisoner in the other cell wonders why Cyrus has suddenly started groveling after weeks of holding him firm. In response, Cyrus holds up the wishbone from the chicken bones and breaks it in half.
The Knave draws off the collectors and then hides. They start to close in but then the Knave hears someone attack them. He emerges from hiding and discovers the Red Queen standing over their unconscious bodies. Pleased to see him, she addresses him by name.
Jafar is meeting with a local goatherd, Akil, who has brought back one of Amara's goats. After giving Akil a filled wineskin as thanks, Jafar goes in to see Amara. She is study a book of spells but when Jafar expresses an interest, tells him that he's not ready. Amara says that they will practice the masking spell now, and notes that it requires a human live. Jafar wonders how they will obtain such an organ and Amara tells him that the wine Akil is drinking is poisoned. As Akil starts choking, Amara hands Jafar the antidote and tells him to use it if he will. However, she warns him that if he cures Akil then he can't learn the spell. While Akil lies dying, Amara explains that she has embraced the serpent as her symbol because it represents rebirth when they shed their skins. She tells Jafar that she must show him that he can do whatever it takes for power and shed his skin, and Jafar hesitantly sets the antidote down on the table. Satisfied, Amara kisses him and says that he has been reborn.
Ion his castle, Jafar is reading from Amara's book of spells when one of the Tweedles appears in his magic mirror. He tells Jafar that the Red Queen is bringing the Knave back to the palace and Jafar assures him that the Tweedle will be suitably rewarded.
Once the Knave is locked up, the Red Queen tells him that he shouldn't have come back to Wonderland. She wonders what Alice offered him to accompany her, and the Knave insists that there's nothing between them. He addresses her by her true name, Anastasia, and asks how long she plans to imprison him. She informs him that it may be forever.
Unsure of who has abducted the Knave, Alice goes to the toadstool entrance to Underland and prepare to fight her way in. a hooded woman stops her and says that the Knave inside. Alice realizes that she's one of the Caterpillar's collectors, but realizes that the woman intends her no harm. Once Alice lowers her sword, the woman removes her hood and introduces herself as Elizabeth--Lizard for short. When Alice says that she's going after the Red Queen, who must have the Knave, Lizard agrees to go with her to collect a debt that the Knave owes her from their shared past.
At the palace, the Red Queen is contemplating a chessboard and an unseen opponent playing white. Jafar comes in and asks why the Knave is still alive, and tells her to cut off his head immediately. When the Queen suggests that the Knave might be more valuable to them alive, Jafar wonders if she's letting her personal feelings interfere with their quest to gain control of all magic. He tells her that it's time to see if she has what it takes to be the Red Queen, and tells her to kill the Knave.
Amara finally shows Jafar the book and explains that it contains all of the known lore about genies. The most powerful spell in the book requires the power of three genies, and Amara believes that with Jafar she has the power to cast the spell and change the very laws of magic. Jafar admits that he doesn't know how he can ever repay her generosity and that no one has ever shown him such kindness, and Amara tells him that no one has ever loved him like she does.
Jafar looks at a case holding two of the three genie bottles required to cast the spell. The third spell in the book is Cyrus'.
In the dungeon, Cyrus sharpens the half of the wishbone against the bottom of the silver cage. Jafar's head guard, Orang, comes in and notices that the genie is up to something. He orders Cyrus to show his hands, and the prisoner palms the bone. However, Orang yanks on the cage chain, causing Cyrus to drop the half-bone out of the cage and onto the walkway. Orang picks it up and studies it, and then throws it into the pit where it falls out of sight.
As Alice and Lizard go to the Red Queen's palace, Lizard explains that the Knave taught her how to be a thief. Alice realizes that Lizard is interested in more than simply collecting a debt, and the thief explains that the Knave took care of her when she needed help. However, she quickly assures Alice that they weren't romantically involved. In fact, she believed that the Knave left Wonderland to avoid any reminders of his former love.
The Red Queen returns to the dungeon to tell the Knave that she has arranged for the White Rabbit to take the Knave to safety outside of Wonderland. She warns him that there are people who want him dead, but the Knave insists that he doesn't want her pity. Disgusted, the Queen tells him that he won't have his head if he doesn't take her pity, and tells him to leave. Confident that the Queen won't kill him because she doesn't have it in her, the Knave says that he's staying where he is. The Queen warns that the surest way to get her to do something is to tell her that she can't, and Will dares her to do it. Furious, the Queen walks away.
Alice and Lizard come to a poster nailed to a tree. After parting the crowd, Alice reads the sign and discovers that the Knave is scheduled for execution.
At the castle, the villagers have gathered in the courtyard and watch as the executioner tests his blade by cutting watermelons and then launching them out of the walls with a caterpillar. Alice and Lizard slip in with the crowd and watch as the Red Queen steps out onto the balcony above to watch the proceedings. Jafar arrives and notices that she's hesitating, and asks if there's anything wrong. She complains that he's always interfering in her affairs, and he wonders if her affairs are the problem. A Tweedle interrupts to tell his mistress that Alice is in the crowd. She starts to tell her Guards to capture Alice, but Jafar says that it's time to see how far Alice will go.
Jafar goes to a tavern and orders the bartender, Gerard, to hand over the genie in his possession. Gerard refuses, saying that he still has one wish to make and he wants to get it right. Jafar closes the door with a magical gesture and warns the bartender won't leave until he turns over the bottle. Gerard, confident that Jafar can't kill him, points out that he can't hand make his third wish if he's dead. In response, Jafar rams a knife into his hand. Gerard wishes that Jafar cannot do him any harm, and the wounds disappear as the genie's bottle on the shelf briefly activates. Jafar takes it and starts to go, but Gerard calls him a bastard and tells him to go back to the gutter. Furious, Jafar dares Gerard to repeat what he just said. When the bartender points out that he has nothing to fear because Jafar cannot harm him, the sorcerer agrees... and then has Amara come in. She tells Gerard that there are worse things than death, and surrounds him with a cloud of dark magic. She then tells Jafar that they are one bottle away from completing the spell.
The guards bring the Knave out to the executioner's block, and he looks up at the Red Queen. She's unable to meet his gaze, and the executioner prepares to strike. However, he cuts the Knave free and removes her hood, revealing that she's Alice. The two of them jump onto the catapult and cut the line, sending them over the wall. They land in the hedge maze where Lizard is waiting for them, and they run off into the maze. They reach a clearing and Jafar soars down on his magic carpet, while the Red Queen and her guards steps in behind them.
Lizard tries to distract them only for Jafar to knock her unconscious with a spell. Realizing that Alice will do anything for a friend, Jafar magically chokes the Knave and tells Alice to make her wish. The Knave calls to the Red Queen for help, addressing her by name, but she does nothing. Alice finally has no choice but to make her wish: if the Knave dies, she dies with him.
In Jafar's dungeons, Cyrus realizes that Alice has used her first wish.
Jafar admits that Alice has trumped him for the moment, and she points out that she'll die rather than help him. The sorcerer admits that he needs her alive, but he doesn't need her in one pieces. He levitates her into the air and prepares to magically draw and quarter her. Despite the pain, Alice refuses to give in. Jafar finally releases her, but warns that there are worse things than death. To prove his point, he surrounds the Knave with a cloud of dark magic and transforms him into a statue. Jafar warns Alice that he'll hurt everyone she loves until she makes her last two wishes. Now that he knows she has a heart, he plans to exploit that weakness.
Once Jafar leaves, Alice asks the Red Queen to help. She wonders why she should and Alice punches her, and says that she should help because she cares for the Knave. She calls her by her real name and tries to punch her again. The Queen stops her second blow with a gesture, and tells her to either act like a little girl or grow up and accept common sense. As she walks away, Alice points out that she can't kill her and wonders if she will imprison her. The Queen tells her that Wonderland is a prison for Alice, and that eventually the girl will use her last two wishes.
Jafar goes to see Cyrus and tells the genie that Alice used her last two wishes. Soon he will have Cyrus for his own. Jafar bows briefly to the old man in the other cage and then leaves.
Jafar brings Amara a drink and tells her that he's heard rumors that the third bottle is in Agrabah. As he says that they will soon have it, Amara collapses and Jafar tells her that he put a potion in the wine that steals her magical essence using a spell from her book. Amara insists that he loved her and wonders why he's betraying, and Jafar tells her that she only loved him. She warns that no one person can cast the spell and Jafar assures her that she will be helping him. The spell transforms her into a snake and Jafar picks it up and transforms it again, turning it into a snake staff.
Once he and the old man are alone, Cyrus takes out the other half of the wishbone. He tells the old man that genies create the legend of the wishbone granting wishes so that people would use them rather than seek out genies.
Lizard watches from the shadows as the Red Queen returns later and contemplates the Knave's statue.
Jafar leaves his staff in his workshop and walks away, and the staff's eyes glow an angry red.
Cyrus explains that the only magic a wishbone has is that the two halves are always drawn to one another. He places the second half against the floor of the cage, and the first half flies up out of the pit and begins burning through the bottom of the cage to reunite with its other half.