The first church probably dates back to the 4th century. It was expanded into a basilica at the beginning of the 5th century, but fell victim to a devastating earthquake in 455.
After Christian life had regained its strength, a new church was built on the old site, which was consecrated in honor of St. Martin by Theotmar, Archbishop of Salzburg, in 860. This church, too, fell into disrepair over the following decades.
Towards the end of the 9th century, the Hungarians conquered the Carpathian Basin. The country's first Christian king, St. Stephen, had a new wooden church built over the foundations of the earlier churches, which was converted into a brick church a few decades later. This church is mentioned in a letter from Pope Paschal II from 1102. It was expanded around 1230 in the late Romanesque style, decorated with frescoes, and rebuilt in the Gothic style in the 15th century.
A document from 1360 mentions the well in front of the church; legend tells that St. Martin baptized his mother with the water from this well.
In 1638, the Bishop of Győr (Raab), to whose diocese this area belonged at the time, handed over the church and parish to the Dominican Order. During this time, construction began on the current three-aisled church. Thanks to the generous financial support of Countess Elisabeth Erdődy, née Batthyány, the work was continued and completed between 1668 and 1674 according to the plans of the Italian architect Carlo della Torre.