Construction began by orders of the Roman Emperor Constantine I between 318 and 322, and took about 40 years to complete. Over the next twelve centuries, the church gradually gained importance, eventually becoming a major place of pilgrimage in Rome.
Papal coronations were held at the basilica, and in 800, Charlemagne was crowned emperor of the Holy Roman Empire there. In 846, Saracens sacked and damaged the basilica. The raiders seem to have known about Rome's extraordinary treasures. Some holy – and impressive – basilicas, such as St. Peter's Basilica, were outside the Aurelian walls, and thus easy targets. They were "filled to overflowing with rich liturgical vessels and with jeweled reliquaries housing all of the relics recently amassed". As a result, the raiders destroyed Peter's tomb and pillaged the holy shrine. In response Pope Leo IV built the Leonine wall and rebuilt the parts of St. Peter's that had been damaged.
By the 15th century the church was falling into ruin. Discussions on repairing parts of the structure commenced upon the pope's return from Avignon. Two people involved in this reconstruction were Leon Battista Alberti and Bernardo Rossellino, who improved the apse and partially added a multi-story benediction loggia to the atrium facade, on which construction continued intermittently until the new basilica was begun. Alberti pronounced the basilica a structural abomination:
I have noticed in the basilica of St. Peter's in Rome a crass feature: an extremely long and high wall has been constructed over a continuous series of openings, with no curves to give it strength, and no buttresses to lend it support... The whole stretch of wall has been pierced by too many openings and built too high... As a result, the continual force of the wind has already displaced the wall more than six feet (1.8 m) from the vertical; I have no doubt that eventually some... slight movement will make it collapse...
At first Pope Julius II had every intention of preserving the old building, but his attention soon turned toward tearing it down and building a new structure. Many people of the time were shocked by the proposal, as the building represented papal continuity going back to Peter. The original altar was to be preserved in the new structure that housed it.