By the
Pact of Madrid, Peter was constrained to aid
Alfonso XI of Castile in his successful attack on
Algeciras (1344) and his failed attempt on
Gibraltar (1349) by defending against a
Moroccan counterattack. As Peter had no male issue, his brother
Count James of Urgell was the presumptive heir to the Aragonese throne. Peter grew to mistrust the intentions of James over time. Peter decided that he would instead name his daughter
Constance as his heir presumptive notwithstanding the precedents established by
James I and
Alfonso IV to exclude females from the throne. To this end, he demanded that James cede his post as
procurator general, a position which, by tradition, was reserved for the second in line to the Aragonese throne. James fled to
Zaragoza where he gained the favor of certain nobles who wished to reassert their powers via the monarch. Peter eventually succumbed to the pressure to hold a cortes in Zaragoza where he made numerous concessions of royal authority to quell a rebellion he was not yet in a position to crush. One of such concessions was to revoke his attempt to name Constance as heir, and to restore James as
procurator general. To avert additional damage, Peter dissolved the corts on the premise that he had to address a crisis developing in
Sardinia. Not long thereafter, while Peter was in
Catalonia, James suddenly died. Many suspected Peter of having arranged to have James poisoned. Deprived of their leader, the Union of Aragon was greatly weakened. Venturing next to
Valencia, Peter encountered the nascent
Valencian Union which had taken its cue from its counterpart in Aragon. At
Murviedro (
Sagunt), Peter was forced to name his stepbrother Ferran as the new
procurator general. Additional concessions of royal authority were made to appease the Unionists. This time when he attempted to leave a bad situation, Peter was held under guard in Valencia as a prisoner of the Union. Suffering perhaps his greatest humiliation, he and his queen were forced to dance with the common folk to show his subservience. Ironically, his salvation was the
Black Death. Valencia was felled by this plague in May 1348, enabling Peter to escape amid the confusion. Assembling an army of increasingly powerful royalists in Aragon, Peter attacked the unionist forces at the
Battle of Epila on 21 July 1348. Peter won a complete victory. Proceeding to Saragossa, Peter executed only thirteen Union leaders. By fourteenth century standards, this was a great display of magnanimity. Not the same can be said for the fate of Valencia. After being persuaded not to burn the entire city and sow it with salt, many were executed. Of particular note, he had the bell that the Valencian Union rang to summon its meetings melted down. The molten metal from the bell was then poured down the throats of the Union leaders so that they "should taste its liquor." In 1356, he engaged with
Peter I of Castile in what was called the "
War of the Two Peters". It ended in 1375 with the Treaty of Almazan, without a winner due to the
Black Death and several natural disasters. Throughout his reign, Peter IV had frequent conflicts with the inquisitor general of Aragon,
Nicolas Eymerich. In 1349, James invaded Majorca, but was soundly defeated by Peter's troops at the
Battle of Llucmajor, in which he died. After James' death, Peter allowed
James IV, his successor, to retain his royal title on purely formal terms until his death in 1375. After that date, Peter assumed the title. Majorca remained one of the component crowns of the
Crown of Aragon until the
Nova Planta decrees. Peter died in
Barcelona, aged 67. ==Generalitat==