sentences:  According to later legend, during the reign of Justin I, his nephew Justinian had been accused of plotting against the throne and was sentenced to death, avoided after Saints Sergius and Bacchus appeared before Justin and vouched for Justinian's innocence.He was freed and restored to his title of Caesar, and in gratitude vowed that he would dedicate a church to the saints once he became emperor.The construction of this Church of Saints Sergius and Bacchus, between 527 and 536 AD (only a short time before the erection of the Hagia Sophia between 532 and 537), was one of the first acts of the reign of Justinian I.