A center of trade since antiquity, the city of Genoa relied heavily on income from merchant shipping and trade. As such, piracy posed a substantial threat to the city's merchants, who were forced to pay for the defense of their ships. The city was likewise vulnerable to attack, a fact made apparent when in 935 a fleet led by Ya'qub ibn Ishaq al-Tamimi of the Fatimids sacked the city. The Muslim incursion spurred the city to build strong harbor defenses, and renewed interest in an armed merchant marine to patrol the Ligurian Sea. In 1005 the Republic of Genoa was established; The new government was headed by a consul who would be elected every few years by the wealthiest merchants and landowners in the city. The young republic was as such dominated by the needs and desires of the merchant houses, and the navy was given a place of high importance in the new thalassocracy. A High Admiral was appointed, and with the government coordinating the navy, Genoese traders and merchants came to dominate the Ligurian Sea in the 11th century. The city-state was considered one of the four "Repubbliche Marinare" in Italy alongside Venice, Pisa, and Amalfi. However, the early fleet was composed of ships levied from private merchants, fishermen, and lacked dedicated warships. As such, the 11th century fleet was relegated to protecting the trade of the great merchant houses of Genoa, which continued to dominate the politics and economy of the republic. In an effort to suppress piracy, the fleet was occasionally deployed to fight against Muslim corsairs from Aghlabid in North Africa. After decades of disorder caused by the Norman conquest of southern Italy, the Genoese navy assisted in the capture of the city of Mahdia in 1087.