Italy was invaded by the Visigoths in the 5th century, and Rome was sacked by Alaric in 410. The (traditional) last Western Roman emperor, Romulus Augustus, was deposed in 476 by an Eastern Germanic general, Odoacer. He subsequently ruled in Italy for seventeen years as rex gentium, theoretically under the suzerainty of the Eastern Roman Emperor Zeno, but practically in total independence. The administration remained essentially the same as that under the Western Roman Empire, and gave religious freedoms to the Christians. Odoacer fought against the Vandals, who had occupied Sicily, and other Germanic tribes that periodically invaded the peninsula.
In 489, however, Emperor Zeno decided to oust the Ostrogoths, a foederatum people living in the Danube, by sending them into Italy. On February 25, 493 Theodoric the Great defeated Odoacer and became the king of the Ostrogoths. Theodoric, who had lived long in Constantinople, is now generally considered a Romanized German, and he in fact ruled over Italy largely through Roman personnel. The Goth minority, of Arian confession, constituted an aristocracy of landowners and militaries, but its influence over the country remained minimal; the Latin population was still subject to Roman laws, and maintained the freedom of creed received by Odoacer. The reign of Theodoric is generally considered a period of recovery for the country. Infrastructures were repaired, frontiers were expanded, and the economy well cared for. The Latin culture flourished for the last time with figures like Boethius, Theodoric's minister; the Italian Kingdom was again the most powerful political entity of the Mediterranean. However, Theodoric's successors were not equal to him.
The eastern half of the Empire, now centred on Constantinople, invaded Italy in the early 6th century, and the generals of emperor Justinian, Belisarius and Narses, conquered the Ostrogothic kingdom after years of warfare, ending in 552. This conflict, known as Gothic Wars, destroyed much of the town life that had survived the barbarian invasions. Town life did not disappear, but towns in the Dark Ages were smaller and considerably more primitive than they had been in Roman times. Subsistence agriculture employed the bulk of the Italian population. Wars, famines, and disease epidemics had a dramatic effect on the demographics of Italy. The agricultural estates of the Roman era did not disappear. They produced an agricultural surplus that was sold in towns; however slavery was replaced by other labour systems such as serfdom.
The withdrawal of Byzantine armies allowed another Germanic people, the Lombards, to invade Italy. Cividale del Friuli was the first main centre to fall, while the Byzantine resistance concentrated in the coast areas. The Lombards soon overran most of the peninsula, establishing a Kingdom with capital in Pavia, divided into a series of dukedoms. The areas in central-northern Italy which remained under Byzantine control (mostly the current Lazio and Romagna, plus a short corridor between Umbria that connected them, as well as Liguria) became the Exarchate of Ravenna. Southern Italy, with the exception of Apulia, current Calabria and Sicily, were also occupied by the two semi-independent Lombard duchies of Spoleto and Benevento. Under the Imperial authority remained also much of the ports, which eventually turned into actually independent city-states (Gaeta, Naples, Venice).
In the politically unstable situation after the fall of the western empire, the Church often became the only stable institution and the only source of learning. Even the barbarians had to rely on clerics in order to administrate their conquests. Furthermore, the Catholic monastic orders, such as the Benedictines had a major role both in the economic life of the time, and in the preservation of the classical culture.
After the Lombard invasion, the popes (i.e. St. Gregory) were nominally subject to the eastern emperor, but often received little help from Constantinople, and had to fill the lack of stately power, providing essential services (ex. food for the needy) and protecting Rome from Lombard incursions; in this way, the popes started building an independent state.
At the end of the 8th century the popes definitely aspired to independence, and found a way to achieve it by allying with the Carolingian dynasty of the Franks: the Carolingians needed someone who could give legitimacy to a coup against the powerless Merovingian kings, while the popes needed military protection against the Lombards.
In 751 the Lombards seized Ravenna and the Exarchate of Ravenna was abolished. This ended the Byzantine presence in central Italy (although some coastal cities and some areas in south Italy remained under Byzantine control until the eleventh century). Facing a new Lombard offensive, the papacy appealed to the Franks for aid. In 756 Frankish forces defeated the Lombards and gave the Papacy legal authority over all of central Italy, thus creating the Papal States. However, the remainder of Italy stayed under Lombard or Byzantine control.
In 774, upon a Papal invitation, the Franks invaded the Kingdom of Italy and finally annexed the Lombards; as a reward the Frankish king Charlemagne received papal support. Later, on December 25, 800, Charlemagne was also crowned emperor of the Holy Roman Empire by the pope, triggering controversy and disputes over the Roman name. A war between the two empires soon followed; in 812 the Byzantines agreed to recognize the existence of two Roman Empires in return for an assurance that the remaining Byzantine possessions in Italy would be uncontested.
Throughout this period, some coastal regions, and all of southern Italy, remained under Byzantine or Lombard control (see Italy in the Middle Ages). The Imperial authority never extended much south of the Italian peninsula. Southern Italy was divided amongst the two Lombards duchies of Spoleto and Benevento, who accepted Charlemagne's suzerainty only formally (812), and the Byzantine Empire. Coastal cities like Gaeta, Amalfi, Naples on the Tyrrhenian Sea, and Venice on the Adriatic, were Latin-Greek enclaves who were becoming increasingly independent from Byzantium. A conquest of Benevento, otherwise, would have meant the total encompassment of the Papal territories, and probably Charlemagne thought it was good for his relationships with the Pope to avoid such a move. The age of Charlemagne was one of stability for Italy, though it was generally dominated by non-Italian interests. The separation with the Eastern world continued to increase. Leo III was the first Pope to date his Bulls from the year of Charlemagne's reign (795) instead of those of Byzantine emperors. This process of isolation from the Eastern Empire and connection with the Western world of France and Germany, which had started three centuries before, was completed at the beginning of the 9th centuries. Sicily, Calabria, Puglia and the marine cities were the main exceptions to this rule.
After the death of Charlemagne (814) the new empire soon disintegrated under his weak successors. The equilibrium created through the great emperor's charisma fell apart. This crisis was due also to the emergence of external forces, including the Saracen attacks and the rising power of the marine republics. Charlemagne had announced his division of the Empire in 806: the Lombard-Frank reign, together with Bavaria and Alamannia, was to be handed over to his son Pippin of Italy.
After Charlemagne's son Louis the Pious died in 840, the treaty of Verdun in 843 divided the empire. Louis' eldest surviving son Lothar I became Emperor and ruler of the Central Franks. His three sons in turn divided this kingdom between them, and Northern Italy became the Kingdom of Italy under Louis II, Holy Roman Emperor in 839.
The first half of the 9th century saw other troubles for Italy as well. In 827, Muslim Arabs known as Aghlabids invaded and conquered Sicily; their descendants, the Kalbids, ruled the island until 1053 . In 846, Muslim Arabs invaded Rome, looted St. Peter's Basilica, and stole all the gold and silver in it. In response, Pope Leo IV started building the Leonine walls of the Vatican City in 847; they were completed in 853.In the late ninth century the Byzantines and the Franks launched a joint offensive against the Arabs in southern Italy; however, only the Byzantines won any territory in that campaign.
With Charlemagne's conquest of 774, the north of Italy was politically separated from the south completely. Though the Byzantines had continued to hold most of Apulia and Calabria and the Lombard duchies of the south had been aloof of Pavian policies for a century, the situation was exacerbated by the loss of a centralising Lombard authority in the north. Immediately, the duke of Benevento, Arechis II, proclaimed himself a sovereign prince and set about opposing Charlemagne's assumption of Lombard kingship.
Under Arechis and his successors, it was the Beneventan policy to do homage to the Carolingian emperors and ignore their rulings. De facto independence of both Frankish and Byzantine authority was the result. The principality of Benevento reached its territorial peak under Sicard in the 830s. At his time, the Mezzogiorno was suffering the ravages of the Saracens, against whom Sicard warred constantly. He also warred against his Greek neighbours, especially Sorrento, Naples, and Amalfi. It was in a war with Naples, that Duke Andrew II first called in Saracen mercenaries, thus precipitating a problem that would plague the land for the next two centuries.
In 839, Sicard was assassinated and a civil war broke out which illustrated the nature of political power in the south. It was still largely in the hands of the land-owning aristocracy, who had the power to choose a prince. In 839, some chose Radelchis I, the treasurer and assassin, and some chose Siconulf, who was installed at Salerno. This civil war continued apace for a decade, during which the gastaldates of Benevento took the opportunity to entrench their independence, especially Capua, which sided with Siconulf. In 849, the Emperor Louis II, in one of his first acts as King of Italy, descended the peninsula and imposed his will for peace on the dueling Lombards. He divided the principality into two: one at Benevento, one at Salerno. Thenceforward, the history of the Lombard south is one of declining, competing powers.
In the Tyrrhenian Greek cities, the violence raging inland, between them and their fellow Greeks on toe and heel, fostered the circumstances of de facto independence. Naples, in particular, had a history of differences with Byzantium and had in the past sought to make herself dependent on other authorities, often papal. In 801, the Byzantine patrician of Sicily succeeded in make one Anthimus duke, but he was unable to control the cities under his rule, Gaeta and Amalfi. Subsequent to Anthimus, the patrician tried to appoint his own candidate without imperial approval. The people rebelled and accepted Stephen III in 821. Over his decade of rule, Naples severed all legal ties to Constantinople and even began minting her own coins. In 840, after a brief flirtation with Frankish servitude, to Lothair I, and a Frankish duke, in the person of Duke Contard, the Neapolitan citizenry elected Sergius I their magister militum. Sergius established a dynasty, the Sergi, that was to rule the duchy for the next three hundred years.
In Gaeta, as in Naples, the violent situation inland required special defence. The Gaetans received their first imperial hypati around the time of the Beneventan civil war. While the first hypati remained Byzantine loyals, in 866, the sudden appearance of a new dynasty with Docibilis I forces the conclusion that Gaeta, too, had moved away from Byzantium and Naples towards independence. The first elected ruler of Amalfi was a prefect appearing in 839, simlutaneous with the death of Sicard and the appearance of a Gaetan hyaptus. However, Naples, Gaeta, Amalfi, the Tyrrhenian cities, and Venice (in North Italy) retained some allegiance to Byzantium until the eleventh century-long after becoming de facto independent.
The period following the Beneventan civil war was one of confusion, brought on by the independence movements in the various cities and provinces and by the Saracen onslaught. In Salerno, a palace coup removed Siconulf's successor Sico II in 853 and destabilised that principality until a new dynasty, the Dauferidi, came to power in 861.
In 852, the Saracens took Bari and founded an emirate there. Greek power being significantly threatened, as well as Adriatic commerce, the Byzantine emperor requested an alliance from Louis II of Italy. Similarly, the new prince of Benevento, Adelchis, an independent-minded ruler, also sought his aid. Louis came down and retook Bari in 871 after a great siege. Louis then tried to set up greater control over all the south by garrisoning his troops in Beneventan fortresses. The response of Adelchis to this action was to imprison and rob the emperor while he was staying the princely palace at Benevento. A month later, the Saracens had landed with a new invasive force and Adelchis released Louis to lead the armies against it. Adelchis forced Louis to vow never to re-enter Benevento with an army or to take revenge for his detention. Louis went to Rome in 872 and was released from his oath by Pope Adrian II on 28 May. His attempts to punish Adelchis were not very successful. Adelchis vacillated between nominal fealty to the Carolingian and Byzantine emperors, but, in fact, by his alterations to the Edictum Rothari, he acknowledged himself as the legitimate Lombard "king."
The successors of Adelchis were weak and the principality of Benevento declined just as Salernitan power was beginning to make itself felt. Guaifer of Salerno was on friendly terms with the Saracens, a habit which annoyed the popes and often put a ruler at odds with his neighbours. The south Italian lords continually rotating in their allegiances. Guaifer's successor, Guaimar I, made war on the Saracens. Guaifer had originally associated Guaimar with him as co-ruler, a practice which became endemic to the south and was especially evident in Capua.
Under the Macedonian dynasty, Byzantine power experienced a recovery; and the impact of this was felt in southern Italy. During the late ninth century the amount of territory under direct Byzantine rule (which in the early ninth century was limited to the toe and heel of the peninsula) expanded dramatically. The Catapanate of Italy was set up to administer the newly-acquired territory. The rest of Southern Italy remained divided among the Lombard kings and the Italian cities. Both sets of principalities were de-facto independent, but paid nominal allegiance to Byzantium.
The Byzantine gains in the southern Italian mainland were, however, accompanied by setbacks in Sicily. In 878 the Arabs captured the crucial city of Syracuse, and by 902 the entire island was under Arab rule.
In the eleventh century, the Normans occupied the Lombard and Byzantine possessions in Southern Italy, ending the six century old presence of both powers in the peninsula. The independent city-states were also subdued. During the same century, the Normans also ended Muslim rule in Sicily. Norman rule in what had once been Byzantine territory naturally angered Byzantium, which in the twelfth century attempted to reassert its authority in Southern Italy.
In 1155 the Byzantine Emperor Manuel I Comnenus attempted to invade southern Italy. The Emperor sent his generals Michael Palaeologus and John Ducas with Byzantine troops and large quantities of gold to invade Apulia (1155). The two generals were instructed to enlist the support of German emperor Frederick Barbarossa, since he was hostile to the Normans of Sicily and was south of the Alps at the time, but he declined. Nevertheless, with the help of disaffected local barons including Count Robert of Loritello, Manuel's expedition achieved astonishingly rapid progress as the whole of southern Italy rose up in rebellion against the Sicilian Crown. There followed a string of spectacular successes as numerous strongholds yielded either to force or the lure of gold.
The City of Bari, which had been the capital of the Byzantine Catapanate of Southern Italy for centuries before the arrival of the Normans, opened its gates to the Emperor's army, and the overjoyed citizens tore down the Norman citadel as a hated symbol of Norman oppression. Encouraged by the success, Manuel dreamed of restoration of the Roman Empire at cost of union between Orthodox and Catholic Church, a prospect which would frequently be offered to the Pope during negotiations and plans for alliance. Negotatiations were hurriedly carried out, and an alliance was formed between Manuel and Pope Adrian IV. The future looked bleak for the Sicilians.
However, the invasion soon stalled. Michael was recalled to Constantinople. Although his arrogance had slowed the campaign, he was a brilliant general in the field, and his loss was a major blow to the campaign. The turning point was the Battle for Brindisi, where the Sicilians launched a major counter attack by both land and sea. At the approach of the enemy, the mercenaries that had been hired with Manuel's gold demanded impossible rises in their pay. When this was refused, they deserted. Even the local barons started to melt away, and soon John Ducas was left hopelessly outnumbered. The naval battle was decided in the Sicilians' favour, and John was captured. The defeat at Brindisi put an end to the restored Byzantine reign in Italy, and by 1158 the Byzantine army had left Italy, with only a few permanent gains.
In the eighth and ninth centuries towns such as Amalfi and Venice began to prosper because of intra-Italian and international trade in goods such as salt and silks. Italian traders reached cities such as Alexandria and Constantinople. Salt from the Venetian lagoon was sold to other Italians. However, the amount of urban activity remained small.
The 11th century signalled the end of the darkest period in the Middle Ages. Trade slowly picked up, especially on the seas, where the four Italian cities of Amalfi, Pisa, Genoa and Venice became major powers. The papacy regained its authority, and started a long struggle with the empire, about both ecclesiastical and secular matter. The first episode was the Investiture controversy. In the twelfth century those Italian cities which lay in the Holy Roman Empire launched a successful effort to win autonomy from the Holy Roman Empire (see Lombard League); this made north Italy a land of quasi-independent or independent city-states until the nineteenth century (see Italian city-states and history of every city). The revolts were funded by Byzantium, which hoped to expel the Germans from Italy; this sponsorship was, like the invasion of the South, part of a twelfth-century Byzantine effort to regain the influence it had held on the peninsula during the reign of Justinian.
Meanwhile, the South and Sicily were invaded by Normans, who eventually conquered what remained of the Byzantine holdings in mainland Italy along with the Arab possessions in Sicily (see Kingdom of Sicily).