The Portuguese maintained a hold on Muscat for over a century, despite challenges from Persia and a bombardment of the town by the Ottoman Turks in 1546. The Turks twice captured Muscat from the Portuguese, in the Capture of Muscat (1552) and 1581–88. The election of Nasir bin Murshid Al-Ya'rubi as Imam of Oman in 1624 changed the balance of power again in the region, from the Persians and the Portuguese to local Omanis. Among the most important castles and forts in Muscat, the Al Jalali Fort and the Al-Mirani Fort are the most prominent buildings left by the Portuguese. On August 16, 1648 the Imam dispatched an army to Muscat, which captured and demolished the high towers of the Portuguese, weakening their grip over the town. Decisively, in 1650, a small but determined body of the Imam's troops attacked the port at night, forcing an eventual Portuguese surrender on January 23, 1650. A civil war and repeated incursions by the Persian king Nader Shah in the 18th century destabilised the region, and further strained relations between the interior and Muscat. This power vacuum in Oman led to the emergence of the Al Bu Sa‘id dynasty, which has ruled Oman ever since.