In 238 BC Sardinia became, along with Corsica, a province of the Roman Empire. The Romans ruled the island until the middle of the 5th century, when it was occupied by the Vandals, who had also settled in north Africa. In 534 AD it was reconquered by the Romans, but now from the Eastern Roman Empire, Byzantium. It remained a Byzantine province until the Arab conquest of Sicily in the 9th century. After that, communications with Constantinople became very difficult, and powerful families of the island assumed control of the land.
Facing Arab attempts to sack and conquer, while having almost no outside help, Sardinia utilized the principle of translatio imperii ("transfer of rule") and continued to organize itself along the ancient Roman and Byzantine model. The island was not the personal property of the ruler and of his family, as was then the dominant practice in western Europe, but rather a separate entity and during the Byzantine Empire, a monarchical republic, as it had been since Roman times.
Starting from 705–706, Saracens from north Africa (recently conquered by Arab armies) harassed the population of the coastal cities. Information about the Sardinian political situation in the following centuries is scarce. Due to Saracen attacks, in the 9th century Tharros was abandoned in favor of Oristano, after more than 1800 years of occupation; Caralis, Porto Torres and numerous other coastal centres suffered the same fate. There is a record of another massive Saracen sea attack in 1015–16 from the Balearics, commanded by Mujāhid al-ʿĀmirī (Latinized as Museto). The Saracen attempt to invade the island was stopped by the Judicates with the support of the fleets of the maritime republics of Pisa and Genoa, free cities of the Holy Roman Empire. Pope Benedict VIII also requested aid from the maritime republics of Pisa and Genoa in the struggle against the Arabs.
After the Great Schism, Rome made many efforts to restore Latinity to the Sardinian church, politics and society, and to finally reunify the island under one Catholic ruler, as it had been for all of southern Italy, when the Byzantines had been driven away by Catholic Normans. Even the title of Judge was a Byzantine reminder of the Greek church and state , in times of harsh relations between eastern and western churches (Massacre of the Latins, 1182, Siege of Constantinople (1204), Recapture of Constantinople, 1261).
Before the Kingdom of Sardinia and Corsica, the Archons (ἄρχοντες) or, in Latin, judices, who reigned in the island from the 9th or 10th century until the beginning of the 11th century, can be considered real kings of all Sardinia (Κύριε βοήθε ιοῦ δού λού σου Tουρκοτουρίου ἅρχωντοσ Σαρδινίας καί τής δού ληςσου Γετιτ), even though nominal vassals of the Byzantine emperors. Of these sovereigns only two names are known: Turcoturiu and Salusiu (Tουρκοτουριου βασιλικου προτοσπαθαριου  και Σαλουσιου των ευγενεστατων άρχωντων), who probably ruled in the 10th century. The Archons still wrote in Greek or Latin, but one of the oldest documents left of the Judicate of Cagliari (the so-called Carta Volgare), issued by Torchitorio I de Lacon-Gunale in 1070, was already written in the Romance Sardinian language, albeit with the Greek alphabet.
The realm was divided into four small kingdoms, the Judicates, perfectly organized as was the previous realm, but was now under the influence of the Pope and the Holy Roman Empire. That was the cause of conflicts leading to a long war between the Judges, who regarded themselves as kings fighting against rebellious nobles. The Judicates came to an end in 1410, when the new Kingdom of Sardinia and Corsica defeated the Arborea Judicate in a battle in Sanluri and its sovereign rights were sold by the last Judge.
Flag of the Kingdom of Sardinia at the funeral ceremony of Charles V
Later, the title of King of Sardinia was granted by the Emperor of the Holy Roman Empire to Barisone II of Arborea and Enzio of Sardinia. The first could not reunify the island under his rule, despite years of war against the other Sardinian judges, and he finally concluded a peace treaty with them in 1172. The second did not have the opportunity. Invested with the title from his father, Emperor Frederick II in 1239, he was soon recalled by his parent and appointed Imperial Vicar for Italy. He died in 1272 without direct recognized heirs after a detention of 23 years in a prison in Bologna.
The Kingdom of Sardinia and Corsica (later, just the "Kingdom of Sardinia" from 1460) was a state whose king was the King of Aragon, who started to conquer it in 1324, gained full control in 1410, and directly ruled it until 1460. In that year it was incorporated into a sort of confederation of states, each with its own institutions, called the Crown of Aragon, and united only in the person of the king. The Crown of Aragon was made by a council of representatives of the various states and grew in importance for the main purpose of separating the legacy of Ferdinand II of Aragon from that of Isabella I of Castile when they married in 1469. The idea of the kingdom was created in 1297 by Pope Boniface VIII, as a hypothetical entity created for James II of Aragon under a secret clause in the Treaty of Anagni. This was an inducement to join in the effort to restore Sicily, then under the rule of James's brother Frederick III of Sicily, to the Angevin dynasty over the oppositions of the Sicilians. The two islands proposed for this new kingdom were occupied by other states and fiefs at the time. In Sardinia, three of the four states that had succeeded Byzantine imperial rule in the 9th century had passed through marriage and partition under the direct or indirect control of Pisa and Genoa in the 40 years preceding the Anagni treaty. Genoa had also ruled Corsica since conquering the island nearly two centuries before (c. 1133).
There were other reasons beside this papal decision: it was the final successful result of the long fight against the Ghibelline (pro-imperial) city of Pisa and the Holy Roman Empire itself. Furthermore, Sardinia was then under the control of the very Catholic Kings of Aragon, and the last result of rapprochement of the island to Rome. The Sardinian church had never been under the control of the Ecumenical Patriarchate of Constantinople; it was an autonomous province loyal to Rome and belonging to the Latin Church, but during the Byzantine period became influenced by Byzantine liturgy and culture.