In 1421, king Pedro II of Portugal died. He had been a bad ruler; especially, he hadn't cared for his succession. Thus, the Portuguese Civil War broke out when his two sons Afonso and Diniz (his oldest son Pedro had died already) fought against each other after his death.
1424, Pedro III of Castille decided to interfere in the Portuguese Civil War, even left the second Aquitainian War to do this. At the end, Pedro III became new king of Portugal, and the two sons became princes of North and South Portugal respectively. By using this division, Castillian kings could keep Portugal under control, although they always had to respect Portuguese rights.