Early Middle Ages
During the Germanic invasions of 409 and later as a result of Rechiar's ravaging, Pamplona went through much disruption and destruction, starting a cycle of general decline along with other towns across the Basque territory, but managing to keep some sort of urban life. During the Visigothic period (fifth to eighth centuries), Pamplona alternated between self-rule, Visigoth domination or Frankish suzerainty in the Duchy of Vasconia (Councils of Toledo unattended by several Pamplonese bishops between 589 and 684). In 466 to 472, Pamplona was conquered by the Visigoth count Gauteric, but they seemed to abandon the restless position soon, struggling as the Visigoth kingdom was to survive and rearrange its lands after their defeats in Gaul. During the beginning of the sixth century, Pamplona probably stuck to an unstable self-rule, but in 541, Pamplona, along with other northern Iberian cities, was raided by the Franks.
Around 581, the Visigoth king Liuvigild overcame the Basques, seized Pamplona and founded the town of Victoriacum. Despite the legend citing Saint Fermin as the first bishop of Pamplona and his baptising of 40,000 pagan inhabitants in just three days, the first reliable accounts of a bishop date from 589, when bishop Liliolus attended the Third Council of Toledo. After 684 and 693, a bishop called Opilano is mentioned again in 829, followed by Wiliesind and a certain Jimenez from 880 to 890. Even in the 10th century, important gaps are found in bishop succession, which are recorded unbroken only after 1005.
At the time of the Umayyad invasion in 711, the Visigothic king Roderic was fighting the Basques in Pamplona and had to turn his attention to the new enemy coming from the south. By 714–16, the Umayyad troops had reached the Basque-held Pamplona, with the town submitting apparently after a treaty was brokered between the inhabitants and the Arab military commanders. The position was then garrisoned by Berbers, who were stationed on the outside of the actual fortress, and established the cemetery unearthed not long ago at the Castle Square (Plaza del Castillo). In the following years, the Basques south of the Pyrenees do not seem to have shown much resistance to the Moorish thrust, and Pamplona may even have flourished as a launching point and centre of assembly for their expeditions into Gascony. In 740, the Wali (governor) Uqba ibn al-Hajjaj imposed direct central Cordovan discipline on the city. In 755, though, the last governor of Al-Andalus, Yusuf al Fihri, sent an expedition north to quash Basque unrest near Pamplona, resulting in the defeat of the Arab army.
From 755 until 781, Pamplona remained autonomous, probably relying on regional alliances. Although sources are not clear, it seems apparent that in 778, the town was in hands of a Basque local or a Muslim rebel faction loyal to the Franks at the moment of Charlemagne's crossing of the Pyrenees to the south. However, on his way back from the failed expedition to Saragossa in August, the walls and probably the town were destroyed by Charlemagne (ahead of the Frankish defeat in the famous Battle of Roncevaux), out of fear that the anti-Frankish party strong in the town might use the position against him. After Abd al-Rahman I's conquest, Pamplona and its hinterland remained in a state of shaky balance between Franks, regional Andalusian lords and central Cordovan rule, all of whom proved unable to permanently secure dominance over the Basque region. To a considerable extent, that alternation reflected the internal struggles of the Basque warrior nobility.
After the Frankish defeat at Roncevaux (778), Pamplona switched again to Cordovan rule, after Abd-al-Rahman's expedition captured the stronghold in 781. A wali or governor was imposed, Mutarrif ibn-Musa (a Banu-Qasi) up to the 799 rebellion. In that year, the Pamplonese—possibly led by a certain Velasko—stirred against their governor, but later the inhabitants provided some support for the Banu Qasi Fortun ibn-Musa's uprising. This regional revolt was shortly after suppressed by the Cordovan emir Hisham I, who re-established order, but failed to retain his grip on the town, since the Pamplonese returned to Frankish suzerainty in 806. A Muslim cemetery containing about 200 human remains mingled with Christian tombs was unearthed in 2003 at the Castle Square, bearing witness to an important Muslim presence in the city during this period, but further research was stopped by the destruction of this and other historic evidence as decided by the city council, headed by mayor Yolanda Barcina.
Following a failed expedition to the town led by Louis the Pious around 812, allegiance to the Franks collapsed after Enecco Arista rose to prominence. Moreover, he was crowned as king of Pamplona in 824, when the Banu Qasi and he gained momentum in the wake of their victorious second battle of Roncevaux. The new kingdom, inextricably linked to the Banu Qasi of Tudela, strengthened its independence from the weakened Frankish empire and Cordoban emirate.
During this period, Pamplona was not properly a town, but just a kind of fortress. In 924, Cordovan sources describe Pamplona as "not being especially gifted by nature", with its inhabitants being poor, not eating enough, and dedicated to banditry. They are reported to speak Basque for the most part, which "makes them incomprehensible". On 24 July, after Christian troops and citizens fled, troops from Cordova sacked Pamplona, destroying houses and buildings including its celebrated church.
The town only regained its urban and human shape after the end of raids by Vikings and Andalusians on the province. Especially after 1083, traffic on the Way of St James brought prosperity and new cultures via travelers from north of the Pyrenees.