The Siege of Eger occurred during the 16th century Ottoman Wars in Europe. In 1552 the forces of the Ottoman Empire led by Kara Ahmed Pasha laid siege on the Castle of Eger, located in the northern part of the Kingdom of Hungary, but the defenders led by István Dobó repelled the attacks and defended the castle. Later, the siege has become an emblem of national defense and patriotic heroism in Hungary.
While István Dobó and his soldiers managed to defend the fortress in 1552, in 1596 the captain at that time and the foreign mercenaries under his rule handed it over. This was the beginning of the 91-year-long Turkish rule in Eger. The minaret, which was built at the end of the 17th century, preserves the memory of this period. Among all the buildings of this type, the minaret of Eger is found in the northernmost point of the former Ottoman Empire. During the Turkish occupation Eger became the seat of a vilayet which is a Turkish domain including several sanjaks. Churches were converted into mosques, the castle rebuilt, and other structures erected, including public baths and minarets.
The rule of the Turks in Central Hungary began to collapse after a failed Ottoman attempt to capture Vienna. The Vienna-based Habsburgs, who controlled the rest of Hungary, apart from Transylvania, steadily expelled the Turks from the country. The castle of Eger was starved into surrender by the Christian army led by Charles of Lorraine in 1687, after the castle of Buda had been retaken in 1686. Eger was relieved from Turkish rule in December, 1687. Although the reoccupation was effected by a siege (which starved out the defenders) and not by a bombardment, the town fell into a very poor state. According to the ... records there were only 413 houses in the area within the town walls which were habitable and most of these were occupied by left over Turkish families.