When something gets really big, its parts become huge in numbers too. The Hagia Sophia strengthened its almost 1500 years old (BC 537) fame with this very “greats”. Its legends are among them.
Many writers or famous people either tried to make up some legends or twisted the existing legends in order to become a part of these legends so they can be mentioned and honored together with the Hagia Sophia.
During the time of Byzantine and Ottoman eras, numerous books have emerged about the legends of the Hagia Sophia. Such legends were created by referring to one or two existing sources and as well as one or two non-existing ones. Sometimes, in order to strengthen these legends, their sources were divided and different versions of the same legend taken from two or three different sources were merged into one.
What’s most interesting is that these legends were made up in line with “the time and the place”. In order to support the political conduct of the era, legends were constructed over the Hagia Sophia and spread among the people. To phrase it with a popular statement of nowadays, “in order to support the official ideology”, Hagia Sophia was used as a supporting theme.
Even though there were various tales emerged about this edifice in every era, “The Angel and the Apprentice” is arguably the most important of the Hagia Sophia’s many legends. .
The most sophisticated version of the legend appears in the Anonymous by a Russian traveler visiting Constantinople in between the years 1389 and 1395.
“When arrived at Hagia Sophia, the entrance of the landing platform is from the south gate. There is a little church dedicated to Saint Michael. St. Michael appeared to a young man who was the watchman of the construction site of the same church.
Saint Michael appeared all of a sudden and asked the young man this question; “Where is the construction masters of this church and what is the name of it?”
The young man answered Saint Michael in a confused and also in a fearful way; “The masters went to the Palace for dinner and the church doesn’t have a name ”
“Go and inform your masters. They should finish the construction of this church dedicated to Hagia Sophia straightaway.
“My honorable lord, your appearance frightened me, your light made me blind. What is your name, my honorable lord?”
“My name is Michael”
“Honorable lord Michael, I can’t leave this place until my masters come back”
Hearing this, St. Michael asked the young man.
“What is your name?”
“My name is Michael”
“Michael, go to the Emperor and tell him to order your masters to finish this church dedicated to Hagia Sophia straightaway: I will wait the construction site of Hagia Sophia on behalf of you and as I have the power of Holy God (Spirit) Jesus, I will not leave here until you return”
Apprentice Michael appeared before the Emperor, told him St. Michael appeared to him and delivered his messages. After the Emperor heard what this young man has to say, he thought for a moment and then sent him to Rome. 
Thus the apprentice will not go back to Hagia Sophia and Saint Michael will stay as the protector of Hagia Sophia and Constantinople forever.
The Russian historian Nestor Iskander wrote the history of those days after he joined the ranks of the Turks during the siege. He wrote these notes about May 24;
“The night before Friday all the town was enlightened. The guards afraid that the Turks might be burning down the city, ran towards, saw the sign and started to scream. Some among the crowd saw that a great fire came out of the upper windows of the big Hagia Sophia Church and engulfed the entire dome. After a long time, the fire started to extinguish transformed into a beam of light. This beam of light, which was very hard to describe ascended to the sky all of a sudden. The ones witnessed this event started to bewail and shouted as “Kyrie Eleison”. The beam of light leaned against the wall of the sky: the door of the sky opened, let the beam of light in and then closed again.
The next day, the Patriarch went to the Emperor and informed him that the Angel, who was sent to protect the church during the time of Justinian, has returned to the sky.
According to a Russian Anonym dated 1389, the Angel will stay in the church until the end of the world. Though according to another Russian, Nestor Iskander, the Angel returned to the sky right before the city was about to fall. As a matter of fact, the fall of Constantinople was a harbinger of the Doomsday according to both Christian and some Islamic sources as well during those times.
Kutsi Akıllı The detailed information about this legend and the legends connected to this one, different interpretation of this legend and its changes in time could be found in the researcher and writer Stefanos Yerasimos’s book “Legends of Constantinople and Hagia Sophia in Turkish Texts”
 There is a clear difference between the legends. According to the most common legend about the construction of the Hagia Sophia, Justinian, saw an old man wandering around holding a silver plate in his dreams. Then the old man handed Justinian over the silver plate and told him “Here is the plan of the Hagia Sophia”. In another source, it was mentioned that the constructor had a wife named Sophia.
 In some sources, it is said that the Emperor gave him a big pouch of gold when sending him to Rome, and in some other it is said that he will be executed if he ever returns to Constantinople. In the most elaborate source, it is said that by sending the young apprentice to Rome, Rome represented as the mother of Constantinople. In Byzantine sources, the Emperor sent away the apprentice to Aegean Islands. In Piri Reis’s book “Kitab-i Bahriye” (The Book of Navy), it is written that the son of Ignatur, the architect of the Hagia Sophia, was sent to exile to Sigirciklar Island and died there.