Stephen I of Hungary granted town rights to the settlement, surrounded the town with a plank wall, and founded a school and a monastery. Under his rule the construction of the Romanesque Székesfehérvár Basilica began (it was built between 1003 and 1038). The settlement had about 3,500 inhabitants at this time and was the royal seat for hundreds of years. 43 kings were crowned in Székesfehérvár (the last one in 1526) and 15 kings were buried here (the last one in 1540).