A theatre – famous for its animal fights – stood in the place of the basilica in the 18th century. Before construction of the church, an enormous flood ravaged the city in 1838, which came to be known as the large flood of Budapest. The square on which the building now stands rose up from the flat plain of Budapest and offered refuge for hundreds of people during the disaster. Survivors considered their fate to be a divine miracle so they donated money to have a church built at the location of their survival. It took a few years for the construction works to actually begin.
Construction first began under the supervision of József Hild in 1851. The building of the church was later taken over by the architect Miklós Ybl who replaced the earlier Classical style with Neo-Renaissance solutions. Miklós Ybl was the most famous Hungarian architect of his time; he designed, among others, the Opera House and the building of the Várkert Bazaar. Works on the basilica were eventually completed by József Kauser in 1905.
During World War II the valuable collection of the Hungarian National Archives and many refugees were provided protection from the bombings in the cellar of the solid building. The church, similarly to much of the city, suffered serious damage. The complete roof structure required replacement. In 1983 the city’s government resolved to completely renovate the basilica and respective works lasted until August 2003.