In 456 A.D., when the Roman Empire was sinking fast, the Vandals of Africa, on their return from a raid in Latium on the mainland, occupied Caralis along with the other coastal cities of Sardinia. In 534 the Vandals were defeated at Tricamari, a place some 30 Km form Carthage, by the troops of the Eastern Emperor Justinian and Sardinia thus became Byzantine. The island was divided into districts called mereie, governed by a judex residing in Caralis (Cagliari) and garrisoned by an army stationed in Forum Traiani (nowadays Fordongianus) under the command of a dux.
Along with the Byzantines and the Eastern monasticism of the followers of St. Basil, Christianity spread throughout the island, except in the Barbagia regions. Here, towards the end of the sixth century, a short-lived independent domain reestablished itself, with Sardinian-heathen lay and religious traditions, one of its kings being Ospitone.
From 640 to 732 the Arabs occupied North Africa, Spain and part of France. In 827 they began their occupation of Sicily. Sardinia remained isolated and was forced to defend herself; thus, the judex provinciae assumed overall command with civil and military powers.
The continual raids and attacks by the Islamized Berbers on the Sardinian shores began in 710 and grew ever more ruinous with time. One by one the coastal towns and cities were abandoned by their inhabitants. The judex provinciae, in order to afford a better defence of the island, assigned his civil and military powers to his four lieutenants in the mereie of Cagliari, Torres or Logudoro, Arborea and Gallura. Around 900, the lieutenants gained their independence, in turn becoming judices (in Sardinian judikes means king) of their own logu or state.
Each one of these four Sardinian states called giudicati constituted a sovereign kingdom, not patrimonial but independent since it was not the property of the monarch. But they were at the same time democratic since all the most important issues of national interest were not for the king (or giudice) himself to decide but were a matter for the representative of the people gathered in assembly called corona de logu.
Each kingdom manned its own fortified boundaries to protect its own political and trading affairs, its own parliament, own laws (cartas de logu), own national languages, own chancelleries, own state emblems and symbols, etc. The kingdom or giudicato of Cagliari was politically pro-Genoese. It was brought to an end in 1258 when its capital, S. Igia, was stormed and destroyed by an alliance of Sardinian-Pisan forces. The territory then became a colony of Pisa. The kingdom or giudicato of Torres, too, was pro-Genoese and came to an end in 1259, on the death of the giudicessa Adelasia. The territory was divided up between the Doria family of Genoa and the Bas-Serra family of Arborea, while the city of Sassari became an autonomous city-republic.
The kingdom or giudicato of Gallura ended in the year 1288, when the last giudice Nino Visconti a friend of Dante's, was driven out by the Pisans who occupied the territory. The kingdom or giudicato of Arborea was almost always under the political and cultural influence of the powerful marine republic of Pisa. It lasted some 520 years, with Oristano as its capital.
In 1297, Pope Boniface VIII in order to settle diplomatically the War of the Vespers, which broke out in 1282 between the Angevins and Aragonese over the possession of Sicily, established motu proprio a hypothetical regnum Sardiniae et Corsicae. The Pope offered it to the Catalan Jaume II the Just, king of the Crown of Aragon (a confederation made up of the kingdoms of Aragon and Valencia, plus the peasants of Catalonia), promising him support should he wish to conquer Pisan Sardinia in exchange for Sicily. In 1323 Jaume II of Aragon formed an alliance with the kings of Arborea and, following a military campaign which lasted a year or so, occupied the Pisa territories of Cagliari and Gallura along with the city of Sassari, naming them kingdom of Sardinia and Corsica.
In 1353, for reasons of state survival, war broke out between the kingdom of Arborea and the kingdom of Sardinia and Corsica part of the Crown of Aragon. In 1354 the Aragonese seized
Alghero and reshaped it into an entirely Catalan city, which still today displays its Iberian origins. In 1353 Pere IV of Aragon, called the Cerimonious, granted legislative autonomy (a parliament) to the kingdom of Sardinia and Corsica which was followed in due course by self-government (Viceroy) and judicial independence (Royal Hearing).
From 1365 to 1409 the kings or giudici of Arborea Mariano IV, Ugone III, Mariano V (assisted by his mother Eleonora, the famous giudicessa regent) and Guglielmo III (French grandson of Eleonora) succeeded in occupying very nearly all Sardinia except Castel of Cagliari (today Cagliari) and Alghero. In 1409 Marti the Younger, king of Sicily ad heir to Aragon, defeated the giudicale Sardinians at Sanluri and conquered once and for all the entire land. Shortly afterwards he died in Cagliari of malaria, without issue, and consequently the Crown of Aragon passed into the hands of the Castilians Trastamara, and in particular Ferran I of Antequera and his descendants, with the Compromise of Caspe in 1412.
tomb of Marti the Younger is in Cagliari Cathedral.