Malta has been inhabited since 6400 BC initially by Mesolithic hunter gatherers, who were replaced by Neolithic farmers from Sicily around 5400 BC. These farmers practiced mixed farming after clearing most of the existing conifer forest that dominated the islands, but their agricultural methods degraded the soil until the islands became uninhabitable. The islands were repopulated around 3850 BC by a civilization that at its peak built the Megalithic Temples, which today are among the oldest surviving buildings in the world. Their civilization collapsed in around 2350 BC; the islands were repopulated by Bronze Age warriors soon afterwards.
Malta's prehistory ends in around 700 BC, when the islands were colonized by the Phoenicians. They ruled the islands until they fell in 218 BC to the Roman Republic. The island was acquired by the Eastern Romans or Byzantines in the 6th century AD, who were expelled by Aghlabids following a siege in 870 AD. Malta may have been sparsely populated for a few centuries until being repopulated by Arabs in the 11th century. The islands were invaded by the Norman County of Sicily in 1091, and a gradual re-Christianization of the islands followed. At this point, the islands became part of the Kingdom of Sicily and were dominated by successive feudal rulers, including the Swabians, the Aragonese, and eventually the Spanish. The islands were given to the Order of St. John in 1530, which ruled them as a vassal state of Sicily. In 1565, the Ottoman Empire attempted to take the islands in the Great Siege of Malta, but the invasion was repelled. The Order continued to rule Malta for over two centuries, and this period was characterized by a flourishing of the arts and architecture and an overall improvement in the social order. The Order was expelled after the French First Republic invaded the islands in 1798, marking the beginning of the French occupation of Malta.