In 1344 Peter IV of Aragon took the Kingdom of Majorca and Perpignan once more became part of the County of Barcelona. A few years later Perpignan lost approximately half of its population to the Black Death. Perpignan was attacked and occupied by Louis XI of France in 1463, but in 1493 Charles VIII of France gave it back to Ferdinand II of Aragon.