a part of the Berber Almohad empire and of the Hafsids kingdom. 16th to 19th centuries In 1510, it was taken by Pedro Navarro, Count of Oliveto for Spain, and, in 1530, it was assigned, together with Malta, to the Knights of St. John, who had lately been expelled by the Ottoman Turks from their stronghold on the island of Rhodes. Finding themselves in very hostile territory, the Knights enhanced the city's walls and other defenses. Though built on top of a number of older buildings (possibly including a Roman public bath), much of the earliest defensive structures of the Tripoli castle (or "Assaraya al-Hamra", i.e., the "Red Castle") are attributed to the Knights of St John. Having previously combated piracy from their base on Rhodes, the reason that the Knights were given charge of the city was to prevent it from relapsing into the nest of Barbary pirates it had been prior to the Spanish occupation. The disruption the pirates caused to the Christian shipping lanes in the Mediterranean had been one of the main incentives for the Spanish conquest of the city. The knights kept the city with some trouble until 1551, when they were compelled to surrender to the Ottomans, led by the Muslim Turkish commander Turgut Reis. Turgut Reis served as pasha of Tripoli. During his rule, he adorned and built up the city, making it one of the most impressive cities along the North African Coast. Turgut was buried in Tripoli after his death in 1565. His body was taken from Malta, where he had fallen during the Ottoman siege of the island, to a tomb in the Sidi Darghut Mosque which he had established close to his palace in Tripoli. The palace has since disappeared (supposedly it was situated between the so-called "Ottoman prison" and the Arch of Marcus Aurelius), but the mosque, along with his tomb, still stands, close to the Bab Al-Bahr gate. After the capture by the Ottoman Turks, Tripoli once again became a base of operation for Barbary pirates. One of several Western attempts to dislodge them again was a Royal Navy attack under John Narborough in 1675, of which a vivid eye-witness account has survived. Effective Ottoman rule during this period (1551–1711) was often hampered by the local Janissary corps. Intended to function as enforcers of local administration, the captain of the Janissaries and his cronies were often the