Until 1815 the Beylik of Tunis maintained a corsair navy to attack European shipping, raid coastal towns on the northern shores of the Mediterranean and defend against incursions from Algiers or Tripoli. After 1815 Tunis tried, with limited success, to create a modern navy, which fought in the Greek War of Independence and the Crimean War.