It was constructed in the time of Pope Leo III (795–816). The emperor lodged there and erected and operated a tribunal at the location. Otto II used it as his residence in the city, and, notably, died there. The church traced its origins to an ancient square structure that grew up underneath the tower of the basilica near the entrance to the atrium. That tower was built, according to the "Liber Pontificalis", by Pope Stephen II (752–757), and reportedly "covered in pieces of gold and silver" (by which is probably meant mosaic decorations in those colors), and provided with three bells, which were a defensive alarm measure. The tower was also decorated with a poetic epigraph, which read as follows, according to De Rossi:  Stephanus referat quas venerare fores Haec tuta est turris trepidis obiecta superbis Elata excludens, mitia corda tegens   It seems that the church was built along with the tower. The front of the church coincided with the external facade, which is to say, of its atrium. Mariano Armellini notes that the doors of the church were made of bronze. Pope Paul I (757–767) adorned the facade with a mosaic of which the antiquarian Giacomo Grimaldi was able to see a part. That same mosaic is mentioned in Barberini Codex XXXIV, 50, in which the church is referred to by the title "Ecclesia S. Mariae in turri supra gradus anteriores scalarum veteris basilicae Vaticanae, cuius frons musivo opere ornata fuit a Sancto Paulo papa primo, qui sedit anno 757." On the church itself, there was a dedicatory inscription underneath a mosaic work on the facade, which read: "Christe tibi sit honor Paulus quod decorat opus." The mosaic depicted a scene representing the Ascension of Christ in the usual manner of the era, in which Christ is shown in the midst of a great cloud and carried up by angels. At the base of the scene were the twelve Apostles in a group, like the one found in the lower church of S. Clemente, which was also commissioned by Paul I. Later on the facade was altered in restorations, which occurred by the time of Pope Nicholas V (1447–1455) whose name appears above the entrance in 1450.