Knowing that it was Nizam (Kingsley) who set him up and was responsible for the King's death, Dastan and Tamina escape to the desert chased by Garsiv's men - but are also tracked by Sheik Amar and Seso (from the Valley of the Slaves) and confronted, with the aim to make them pay for destroying their ostrich racing track and birds. They win him over with the promise that the temple, where they are heading, is full of gold.
While at the Temple, which has been largely destroyed, Garsiv confronts Dastan but soon learns that he is innocent. Just after he apologises he is killed by one of the knife-throwing Hassansins, who steal the dagger. The Sheik and Seso join the two royal heroes to retrieve the dagger from Nizam before he can use it for evil.
At the palace, Seso nominates himself to retrieve it where he must face the knife-throwing Hassansin bodyguard with skills that match his own. Both men die in the battle, but Seso manages to hurl the dagger out the window to be taken away by Dastan.
Dastan takes his brother Tus hostage to explain what has happened and tells him to press the jewel on top of the dagger after he makes his move -- Dastan then stabs himself and dies.
Tus presses the jewel to set the sands of time within the dagger in motion and goes back in time a few moments to stop Dastan stabbing himself. He is now a believer. However Nizam shows up and slices his neck. Dastan escapes again and enters the secret underground layers of the city with Tamina.
Dastan doesn't do so well with an Indiana Jones style passageway and plummets down a few levels, but reaches the huge sands of time column quicker than Tamina. On a small ledge he has a huge battle with the Hassansin's leader who turns up out of the blue. Tamina breaks them up and grabs the guy's snake so it bikes the disfigured assassin in the face, and he falls to his death.
Just at this moment they see that Nizam has plunged the dagger into the sand column and the city is starting to shake on its foundations. Tamina falls but is caught by Dastan - she knows he doesn't have time to save her and remove the dagger so she lets go and falls to her death.
Dastan gets up to the column and fights with his uncle, and removes the dagger. He is thrown back in time, to when they have successfully conquered the city. Dastan accuses Nizam in front of his brothers. After trying at first to deny it, Nizam lunges at the Prince and they fight -- and the old man is soon thrown from a great height. Still with a little fight inside him, Tus stabs the traitor before he can sneakily murder the Prince.
The brothers approach the Princess together and apologise for the attack. Dastan is nominated to be her husband to bring the people closer together, and he presents her with the dagger as a gift with a smile.