As they are on the run, Tamina tells Dastan about the dagger's origins: the gods had decided to sweep mankind from the earth with a great sandstorm because of their sin. But a young girl pleaded with the gods and convinced them to withhold their wrath. The sands from the storms were stored in a great hollow crystal called the Sandglass, with the dagger, called the Dagger of Time, being the only thing that could break the crystal. The Sandglass was hidden beneath Alamut with Tamina's family, descended from the young girl who saved mankind, as its guardians. It is shown that Nizam orchestrated the siege of Alamut so he could hunt for the Sandglass and use the sands to change an event in his youth where he saved Sharaman from a lion, thereby ensuring Nizam would become king.
Seeing that the sands’ release would destroy the world, Tamina is willing to return the dagger to the place where it was given, giving her life in the process. They reach the dagger's resting place in the Hindu Kush, after being captured by Sheik Amar, but are ambushed by soldiers under the command of Garsiv. Dastan manages to convince Garsiv of his innocence, but the Hassansins attack, take the dagger from Tamina and kill Garsiv. Together with Sheik Amar, his Umbakan guardian Seso and his retinue, Dastan and Tamina head back to Alamut. After retaking the dagger from a Hassansin, who had promptly ended Seso's life, Dastan uses it on himself in front of Tus, showing him the power of the dagger and his own innocence. But Nizam arrives, kills Tus and takes the dagger, leaving Dastan to die. Tamina saves him and they go down into the catacombs of Alamut.
After confronting and defeating Zolm, the Hassansin leader, Dastan and Tamina arrive in the chamber of the Sandglass as Nizam stabs it, starting the release of the sands. When they reach him, Nizam attacks them, and Tamina, who has grown to love the prince, sacrifices herself to give Dastan his chance. Dastan manages to remove the dagger from the Sandglass, preventing the apocalypse, then time is rewound to just after the siege of Alamut, undoing all the events he has lived through. Dastan manages to find his brothers and expose Nizam of his treachery, who attacks Dastan in a rage and is soon killed by Tus.
As an apology for the ransacking of her city, Tus suggests that Dastan and Tamina are married as a goodwill pact. As they converse afterwords, Dastan hints at his knowledge of the dagger’s power and says he looks forward to their future together.