Gerold (died 1 September 799) was an Alamannian nobleman who served the Frankish King, Charlemagne, as Margrave of the Avar March and Prefect of Bavaria in what is now South-Eastern Germany. Gerold played a significant role in the integration of Bavaria into the Frankish Kingdom during Carolingian expansion in the late 8th, and early 9th centuries. Gerold both aided the continuity of Agilofing rule of Bavaria, as well as took steps to integrate Bavarians into the wider scope of the Frankish Kingdom. Gerold was related both to the Agilofing family, the ruling class of Bavaria, as well as the Carolingian family. The Agilofings had ruled Bavaria since Duke Garibald I in 548. Gerold was born into the Agilofings, and his sister Hildegard was married to Charlemagne in 771. From these familial connections, he was appointed Prefect of Bavaria following the deposition of Duke Tassilo III in 788. Gerold was heralded as a superb military commander, giving rise to his promotion to Prefect as a defender of the eastern border of the Frankish Kingdom. In 799, Gerold is said to have fallen in battle against the Avars, shortly after the same Avars killed his ally, Eric, Duke of Friuli, through treachery. Carolingian conquest of Bavaria and the deposition of Duke Tassilo III The Agilofing family had dominated the position of Duke of Bavaria from 548 until 788, when Duke Tassilo III was deposed in the wake of his surrender of the Duchy of Bavaria. In 787, following the conquests of both Lombardy and Saxony by the Franks, the Frankish King, Charlemagne, invaded Bavaria from Pannonia, determined to seize it as a buffer state against the Avars, much like he had done in Friuli. In October of 787, having been unable to mount a suitable defense against the Franks, Tassilo III was forced to capitulate, surrendering to Charlemagne both himself and his Duchy, in the hope of continued rule as a vassal to the Frankish King. No such good will was to be found. In 788, following a brief continued rule by Tassio, Charlemagne had him retroactively accused and denounced as an oath-breaker, as he had betrayed the Franks, and namely Charlemagne's father Pippin, years earlier. Tassilo III was sentenced to death. This sentence was commuted, and Tassilo III was sentenced to monastic exile. Tassilo would eventually be called out of exile to surrender all claim to his Ducal title. Gerold's rule