He transferred his loyalties to Bonaparte at the opportune moment and served him well for many years, being richly rewarded for it. In 1804 he became Grand Chamberlain of the Empire, then Arch-Chancellor and Grand Elector, and was given as an apanage the principality of Benevento in what had been the Papal States.