 In 1514 the territory of Apecchio was elevated to the title of county and governed by its own laws until 1752, when the male branch of the Ubaldini family died out with Frederick II (1745–52).The Holy See regained direct control over the territory, occupying it immediately.It remained under The Holy See, except during the French occupation of the Napoleonic age, up to the unification of Italy in the 19th century.