James died in 1276, having partitioned his domains between his sons in his will. The will created a new Kingdom of Mallorca from the Balearic islands and the mainland counties of Roussillon or Montpellier, which was left to his son James II. However, the terms of the will specified that the new kingdom be a vassal state to the Crown of Aragon, which was left to his older brother Peter. Chafing under the vassalage, James joined forces with the Pope Martin IV and Philip III of France against his brother in the Aragonese Crusade, leading to a 10-year Aragonese occupation before the islands were restored in the 1295 Treaty of Anagni. The tension between the kingdoms continued through the generations until James' grandson James III was killed by the invading army of Peter's grandson Peter IV at the 1349 Battle of Llucmajor. The Balearic Islands were then incorporated directly into the Crown of Aragon.