were founded in the region, in Százd (by the Aba clan, 11th century), Boldva (by the queen, 12th century), Kács (by the Örsúr clan), Tapolca (by the Miskolc clan), Bélháromkút (by the Bishop of Eger, after 1232). The Battle of Mohi – marking the beginning of the Mongol invasion which had a disastrous effect on Hungary – took place in Borsod county, near the village of Muhi, on 11 April 1241. The Mongols defeated the army of King Béla IV. During the two-year invasion, 16 of the county's 69 villages were completely destroyed. In 1248, when King Béla ordered stone castles to be built throughout the kingdom, several new castles were constructed in Borsod county too (Cserépvár, Csorbakő, Dédes, Diósgyőr, Éleskő), many in places of former, destroyed motte castles. The monastery of Boldva was destroyed during a second Mongol invasion in 1285. In the papal tithe registers from 1332 to 1335, the county is mentioned as having 91 parishes. The county had about 240 villages at that time. Before the battle of Mohács (1526), which marks the beginning of the Ottoman occupation of Hungary (lasting for over 160 years) the county had 13 castles, 13 market towns (oppidum, including Miskolc and Mezőkövesd) and 250 villages, owned by 235 different feudal lords including dioceses and monasteries. The steward of the county was the captain of the Castle of Diósgyőr. In 1566, the Ottomans occupied the castles of Dédes and Diósgyőr, and after the Battle of Mezőkeresztes ( 26–28 October 1596) they occupied Miskolc too. These areas were under Ottoman control until 1687. In the next century, an important historical event of Prince Rákóczi's freedom fight took place in the county: the Diet of Ónod, where Hungary was declared independent of Habsburg rule, was held here, next to the village of Ónod, on 18 June 1707. In 1724, it was decided that the county hall of Borsod would be built in Miskolc, thus the town officially became the seat of the county. The building was constructed between 1825 and 1827. There were some minor changes in the area of the county during the 19th century: between 1807 and 1812 the villages Szőlőske, Cegléd, Tihamér, Almagyar, Felnémet and Bekölce (many of these are today city parts of Eger) were annexed to the neighbouring Heves county, while Egerfarmos, Ivánka, Szőkepuszta and the mill of Kistálya were annexed from Heves to Borsod. In 1850 several