The Illusionist

In Vienna, Austria-Hungary, 1889, a magician named Eisenheim (Edward Norton) is arrested by Chief Inspector Walter Uhl (Paul Giamatti) of the Vienna Police during a magic show involving necromancy. Later, Uhl explains the story of Eisenheim's life to Crown Prince Leopold (Rufus Sewell).
Eisenheim was born to a peasant cabinet-maker and became interested in magic after meeting a travelling magician. He also fell in love with Sophie, the Duchess von Teschen (Eleanor Tomlinson), but the two were forbidden to see each other on account of the former being a peasant. They kept meeting secretly but were caught one day and separated by force. Eisenheim proceeded to study magic by travelling the world, and fifteen years later returned to Vienna to perform. During one performance, he encounters the adult Sophie (Jessica Biel) and learns that she is expected to marry the Crown Prince Leopold, who, it is rumored, is brutal towards women and in the past even murdered one. Eisenheim conducts a private show for the Crown Prince and humiliates him in the course of it, in response to which the Crown Prince bans him from performing again in Vienna. Eisenheim asks Sophie to flee with him, but Sophie is afraid that they will be executed. Sophie also reveals that the Crown Prince is planning a coup d'etat against his elderly father, the Emperor Franz Joseph I.
At the Mayerling hunting lodge, Sophie tries to end her engagement with Leopold. He reacts by chasing her into the stables with a sword, in full view of the servants. Sophie's body is discovered the next morning in the Vienna Woods. An unknown man is blamed for her assassination and Eisenheim falls into a deep depression. He eventually buys a theatre and begins a new series of magic shows, this time focusing exclusively on the summoning of dead spirits. Leopold secretly attends one of them, during which Eisenheim summons the spirit of Sophie, who says that someone in the theater is her murderer. Leopold, highly unnerved, orders Uhl to arrest Eisenheim for fraud, but Eisenheim manages to avoid jail by openly confessing to the public that his show is a mere illusion.
Eisenheim is threatened that if he summons Sophie in his next performance, he will be arrested and likely imprisoned. Uhl attends the packed performance with dozens of officers, and in spite of the warnings, Eisenheim brings Sophie's spirit to life again. Uhl storms the stage with his officers, but to the shock and horror of the audience, Eisenheim is revealed to be a spirit after Uhl's hand passes through him. Eisenheim then fades away in front of everyone.
Uhl reveals to Leopold that he found evidence â namely, a jewel from Leopold's sword and Sophie's distinctive locket â which could implicate Leopold in Sophie's murder. Uhl has already informed the Emperor and the General Staff of Leopold's conspiracy to seize the throne. Leopold reacts by pointing a revolver at Uhl and threatening to kill him, but as officers of the imperial guard of the Austro-Hungarian Army arrive on the scene, Leopold shoots himself in the head. As Uhl exits the palace, he is approached by a boy who gives him a folio explaining a magic trick of Eisenheim's that Uhl had been trying to figure out. Realizing it is a message from the illusionist, Uhl re-examines the events in his head and concludes that Sophie and Eisenheim staged her death so she â and Austria â could be free of Leopold. Uhl laughs in delight as Sophie and Eisenheim start a new life together somewhere far away.

Question: Who did the locket once belong to?
Answer: Sophie