 In ancient times this was called "Novempagi "and "Balneum Regium", whence the medieval name of "Bagnorea".During the barbarian invasions of Italy, between the sixth and ninth centuries, the city was taken several times by the Ostrogoths and the Lombards.Charlemagne is said to have included it in the Patrimonium Petri, and the Emperor Louis I to have added it to the Papal States in 822.