In Talmudic times, Adar 28 used to be celebrated to commemorate the rescinding of a Roman decree against ritual circumcision, Torah study and keeping the Shabbat. The decree was revoked through the efforts of Rabbi Yehudah ben Shamua and his fellow rabbis. (Megillat Taanit, Rosh Hashanah 19a)
Ahmed Pasha was the governor of Egypt under Selim II "The Magnificent," the Sultan of the Ottoman Empire. Ahmed plotted to cede from the Ottoman Empire and declare himself Sultan of Egypt. He requested of his Jewish minter Abraham de Castro to mint new Egyptian currency stamped with his image. Instead, De Castro went to Constantinople, and informed Selim II of Ahmed’s plot.
Ahmed decided to exact revenge against Cairo's Jewish community. He imprisoned many of their leaders, and threatened to execute them unless he was paid an outrageously large ransom.
The Jews of Cairo fasted and prayed to G-d. A large sum of money was collected but it did not approach the amount of money Ahmed demanded. Before the planned executions, Ahmed visited his bathhouse. As he was leaving the bathhouse he was attacked and severely wounded by a group of his own advisors and governors. Ahmed escaped but was later captured and beheaded.
From then on, the Jews of Cairo observed the 28th of Adar as a day of celebration. A special megillah (scroll) written to commemorate the miracle was read in Cairo every year on this day.