Capua regained some of its earlier power under Pandulf IV. He was deposed twice between his succession in 1016 and his death in 1050. He was originally an ally of the Byzantines and remained allied with them against all his neighbours until the end. He was constantly in dispute with the church, and with the coastal duchies of Naples, Gaeta and Amalfi. For all this, he was nicknamed the "Wolf of the Abruzzi". He wanted to give Capua a seaport. He deposed the dukes of Naples and Gaeta, and went to war against Guaimar IV, the Prince of Salerno. The Emperor Henry II had him removed and imprisoned, but he eventually won back his throne.