Mu'aytal razes the windmill of Juha, who fled so as not to be arrested. On the Mawlid, when a person assumes the position of sultan for a day, people appoint Juha, who starts issuing decrees for the benefit of the shop owners, but Sharr makes his soldiers burn the shops. Gemara gives birth to a child.
Barquq takes Juha to the king of thieves. Sharr tells Boqtomor that Juha removed everyone except the sultan, so he must be hanged. As the donkey Zaqzouq advises Juha to feign death, Barquq arranges it with the undertaker. Sharr plans with Boqtomor to build a palace for Gemara in place of the shop square.
People dub Juha a holy man as he returned from the dead, and everyone goes to his house to be blessed by him. Gemara asks Sharr to evacuate the square to build the palace. Juha guards the people's shops from being razed. Sharr and his soldiers go with Boqtomor and Gemara's procession to the square.
As the swords of Mu'aytal, Sharr, and the soldiers disappear, everyone thinks that this is the holy man Juha’s doing. Juha agrees with the chief merchant and the elders to repair the merchants' shops in exchange for setting the buying and selling prices in the market according to their advice.
Juha sets the prices in the shop square. When Mu'aytal vanishes, his soldiers think that the jinn kidnapped him. Juha discovers that Barquq and the thieves took the swords and Mu'aytal. Sharr arrests Juha's aides and learns the truth from the undertaker. Bahlaq finds out where Mu'aytal is.
Sharr imprisons Juha, and brings back Mu'aytal from the king’s cave. Before Juha is executed, Mu'aytal tells Sharr that the governor is fleeing as a new sultan has taken over. Gemara leaves her baby, so Qamar takes him. Mu'aytal tells the governor Wahshkamar that a maid took the baby.
Shuhaiber helps Qamar escape with the baby looked for by Wahshkamar, whom the elders tell that they were against the former sultan and ask for the testimony of Juha, who once said the state was a cow milked by the rulers. As their king dies, the thieves tell Juha that he is the new king.
Wahshkamar decrees that he takes half of the elders’ earnings, then appoints a poet and a scholar, whom he makes the chief of soldiers. As an escaped minister asks for Juha’s protection, a publication is issued to execute whoever harbors the former sultan or his aides.
Juha discovers that he’s harboring the former sultan. Sultan Qamar El Din asks Wahshkamar and Juha to arrest the escaped sultan Shams El Din. The elders ask that those who raided their convoy be arrested. Wahshkamar asks Juha to recruit soldiers for the palaces of the elders then rob them for him.
Zaqzouq advises Juha to make the thieves soldiers to guard the elders's warehouses and rob them for himself and not for Wahshkamar, and to make the thieves help the shop owners, who think that Juha sold them out to the elders. Qamar returns home with the baby. The princes ask Juha to build two palaces.
As Bughasha learns that Juha is the king of thieves, she tells the public. Shulah, Ezz, and the elders confirm that Juha is robbing them by making the thieves soldiers, and tell the governor. Ennaba complains to the sultan about Juha’s snubbing Shuhaiber and Qamar, who have the former governor’s son.
Before Juha, his son, Qamar and Barquq are executed, news comes of the return of Sultan Shams to rule, then Boqtomor and Gemara return. The thieves snub Juha, who decides to flee town, but Ennaba refuses. Qamar decides to give the baby to Bughasha, so Sharr wouldn’t catch him with her.
Gemara orders the torture of Juha, Shuhaiber and Qamar. Sultan Shams makes Juha the state judge, whose rulings are as good as the sultan’s decrees, and moves him to a fancy house. Gemara asks Sharr to return her baby and take revenge on Juha. Sharr catches the thieves, with whom he finds the baby.
The public cheers for Juha for his justice after his ruling that the nobles hire thieves and pay them a monthly salary. He also orders that Abu El Saad be made a trade supervisor. But people turn against Juha when he imprisons Shuhaiber and Qamar, as Gemara reported that they’d stolen her baby.
Juha rules that the baby be given to Qamar, enraging Gemara, who takes Boqtomor's place as governor, appointing a judge and a trade supervisor. Sharr learns from Qamar that Shams is a slave who wasn’t freed by his master, so Gemara agrees with Qamar to send gifts to the khan to make her sultan.
As Juha learns that Gemara asked the khan to prosecute Shams because he’s a slave and then she’ll buy him, he offers Shams for sale and makes the thieves steal money from the elders, then people buy their sultan and free him. Gemara tries to arrest Juha, but the Sultan's army intervenes.