With the Germanic incursions of the fifth century, many Romans from the cities of Campania, subject to the order of the barbarians, took refuge on the Lattari Mountains. Some settled in the small village of Amalfi, turning it into a city.

The first traces written on Amalfi date from 533, the time of the war against the Goths. With the victory of Narsete over Teia, the city passed under the rule of the Roman Empire from Byzantium, in the Duchy of Naples, until the early ninth century.

The canoe town officially appears in a letter, written in 596 by Pope Gregorio Magno, in which he mentions the bishop of Amalfi. Bishop’s seat in the sixth century, the bishop held religious functions and provided for the defense of the city. Later, political power was confiscated by the aristocracy of the landowners.
In this letter of 596, Amalfi is designated as castrum, a defensive outpost. Indeed, because of its position, along the southern borders of the Byzantine Duchy of Naples, it served as a refuge against the incursions of the Longobards of Benevento. The latter eventually conquered it, thanks to the betrayal of a few local families, and deported part of its population.

In 836, Sicard the duke of Benevento pillaged Amalfi and deported the inhabitants to Salerno. However, the latter reorganized themselves and taking advantage of the internal divisions of the Longobard court that led to the assassination of Duke Sicard in 839, the Amalfitans revolted. They looted Salerno, liberated the hostages, and on September 1, 839 they founded an autonomous republic which asserted its power until the end of the eleventh century, reinforcing itself to better defend the maritime trade of Amalfi against the attacks of the Longobards Dukes.