Bernard (or Bernat) of Septimania (795–844), son of William of Gellone, was the Frankish Duke of Septimania and Count of Barcelona from 826 to 832 and again from 835 to his execution. He was also count of Carcassonne from 837. He was appointed to succeed his fellow Frank Rampon. During his career, he was one of the closest counsellors of the Emperor Louis the Pious, a leading proponent of the war against the Moors, and opponent of the interests of the local Visigothic nobility.
Bernard was indisputably a count (comes) of Barcelona and several other counties over the course of his long career. He also appears in the chronicles with the title duke (dux), though the extent to which this was a military designation is obscure. He is sometimes retrospectively referred to by historians as a margrave (marchio). Here are his name and title as they appear in several primary sources:
Bernard is first attested in historical records as one of four sons in a document of his father's dating to 14 December 804 dealing with the foundation of the monastery of Gellone.
Bernard must have inherited land in the area around Toulouse from which he expanded his power to become count around 826. He first attracted the attention of higher-ups by quelling the local revolt of a nobleman named Aisso, who was perhaps a Visigothic lieutenant of the deposed Bera, Count of Barcelona. The garrisons of the castles in the area, who had been favorable to Bera, joined Aisso in a revolt against the new count. Only the castle of Roda de Ter, in the county of Ausona, resisted and was subsequently destroyed by Aisso. From his newly occupied territory, Aisso attacked the county of Cerdanya and the region of the Vallès. The young count Bernard requested and received some help from the Emperor, as well as that of some local hispani (probably Gothic noblemen). To counter these reinforcements, Aisso sent his brother to request help from Abd ar-Rahman II, Emir of Córdoba, the only potential ally powerful enough to threaten the Franks. Abd ar-Rahman sent the general Ubayd Allah Abu Marwan to Zaragoza in May 827, from whence he invaded the territory of Barcelona, reaching the city itself in the summer. He besieged it and ransacked its environs, but failed to take it.