The first wooden church was built on the Toompea hill in 1219, just after the capture of the country by the Danes. In 1229, the Dominicans came to the town, who began building a stone temple in its place. The monks were killed in 1233, during the conflict between the Order of Livonian Brothers of the Sword and the supporters of the papal legate. Since then, the unfinished walls of the temple were abandoned, and the building was completed and ordained only in 1240. During the 14th and 15th centuries the cathedral was gradually expanded and developed. Unfortunately, it suffered greatly during the fire of 1684, when all wooden equipment was destroyed and also part of the vaults collapsed. The reconstruction was carried out two years later. During the eighteenth and nineteenth centuries the church underwent numerous rebuildings, which mainly affected the tower, side chapels and interior.
The church from the mid-thirteenth century was a simple, aisleless building with a square chancel on the eastern side. At the beginning of the fourteenth century, it was enlarged by a new, polygonally ended presbytery and a sacristy. In 1330, the building was enlarged from a single nave to a three-aisle one. The protracted reconstruction was completed only in the 30s of the 15th century, when the 29-meter-long nave in the form of a basilica was completed.