Conquered by the Moors in the 8th century, Badajoz became a Moorish kingdom, the Taifa of Badajoz. After the reconquista, the area was disputed between Spain and Portugal for several centuries with alternating control resulting in several wars including the Spanish War of Succession (1705), the Peninsular War (1808–1811), the Storming of Badajoz (1812), and the Spanish Civil War (1936). Spanish history is largely reflected in the town.
Badajoz is the see of the Roman Catholic Archdiocese of Mérida-Badajoz. Prior to the merger of the Diocese of Mérida and the Diocese of Badajoz, Badajoz was the see of the Diocese of Badajoz from the bishopric's inception in 1255. The city has a degree of eminence, crowned as it is by the ruins of a Moorish castle and overlooking the Guadiana river, which flows between the castle-hill and the powerfully armed fort of San Cristobal. The architecture of Badajoz is indicative of its tempestuous history; even the Badajoz Cathedral, built in 1238, resembles a fortress, with its massive walls. Badajoz is home to the CD Badajoz and AD Cerro de Reyes football clubs and the AB Pacense basketball club. It is served by Badajoz Railway Station and Badajoz Airport.
Archaeological finds unearthed in the Badajoz area have been dated to the Bronze Age. Megalithic tombs are dated as far back as 4000 BC, while many of the steles found are from the Late Bronze Age. Other finds include weapons such as axes and swords, everyday items of pottery and utensils, and various items of jewellery such as bracelets. Archaeological excavations have revealed remnants from the Lower Paleolithic period. Artifacts have also been found at the Roman town of Colonia Civitas Pacensis in the Badajoz area, although a significant number of larger artifacts were found in Mérida.
With the invasion of the Romans, which started in 218 BC during the Second Punic War, Badajoz and Extremadura became part of the administrative district called Hispania Ulterior (Farther Spain), which was later divided by Emperor Augustus into Hispania Ulterior Baetica and Hispania Ulterior Lusitania; Badajoz became part of Lusitania. Though the settlement is not mentioned in Roman history, Roman villas such as the La Cocosa Villa have been discovered in the area, while Visigothic constructions have also been found in the vicinity.
Badajoz attained importance during the reign of Moorish rulers such as the Umayyad caliphs of Córdoba, and the Almoravids and Almohads of North Africa. From the 8th century, the Umayyad dynasty controlled the region until the early 11th century. The official foundation of Badajoz was laid by the Muladi nobleman Ibn Marwan, around 875, after he had been expelled from Mérida. Under Ibn Marwan, the city was the seat of an effective autonomous rebel state which was quenched only in the 10th century. In 1021 (or possibly 1031 ), it became the capital of a small Muslim kingdom, the Taifa of Badajoz; with some 25,000 inhabitants. Badajoz was known as Baṭalyaws (Arabic: بَطَلْيَوْس) during Muslim rule. The invasion of Badajoz by Christian rulers in 1086 under Alfonso VI of Castile, overturned the rule of the Moors. In addition to an invasion by the Almoravids of Morocco in 1067, Badajoz was later invaded by the Almohads in 1147.