Bera () (died 844) was the first count of Barcelona from 801 until his deposition in 820. He was also the count of Razès and Conflent from 790, and the count of Girona and Besalú from 812 (or 813 or 817) until his deposition. In 811, he was witness to the last will and testament of Charlemagne. Origins Bera's origins are mostly unknown, although it seems certain that he was a Visigoth. He may have been one of the sons of William of Gellone, Count of Toulouse and cousin of Charlemagne, although this is not supported by William's detailed will from 804. In 790, Bera was given the governorship of the counties of Razès and Conflent, possibly by William. The Counties of Roussillon (with the pagus of Vallespir) and Empúries were given to William's son Gaucelm, whose mother was Gunegunde (Cunegonde), one of William's two wives. Background and installation In 796, Sa'dun al Ruayni, the Wali of Barcelona, attempted to break his allegiance to Al-Hakam I, emir of Córdoba. In April 797, he travelled to Aachen and offered to switch the city's allegiance to Charlemagne in exchange for help against Córdoba. Charlemagne summoned an assembly in Toulouse in the spring of 800 which agreed to send his son Louis the Pious to Barcelona. The army included a number of noble men, among them Rostany of Girona, Adhemar of Narbonne, and William of Toulouse. Sa’dun, however, had changed his mind and the Frankish forces laid siege of Barcelona. Eventually, starving and with Sa’dun having been captured by the Franks trying to reach Caliphate of Cordoba in a plea for help, the city's Visigoth population handed the new Wali Harun over to the Franks with their surrender on Saturday, April 3, 801. Louis entered the city on the following day. Soon after, Bera, who was part of the besieging army, was invested as the first Count of Barcelona. Expeditions across the Ebro Bera took part in the Frankish campaigns in 804, 808, and 809 to extend the southern border of the Marca Hispanica to the River Ebro which was felt to be a natural defendable barrier between the two empires. This was despite his Visigoth mother who urged him to keep peace with the Muslims States to the south and west. First expedition In 804, Louis the Pious led an army to Tarragona. At Santa Coloma, the army divided into two. Louis