@Viriato Thanks for the long answer, very interesting!
I always wondered why the Portuguese spent so much effort of North Africa. I mean, by the end of the XVth century, it wasn't much of a threat anymore and they already had access to the gold, ivory and slaves of Guinea through the sea route.
So why did they keep coming back there? What was there that needed so much blood shed?
During the 15th century, and before access to Guinea it was seen as a major source of Gold. The access to grains from North Africa was also seen as a major prize. This of course they lost their importance in 1482, when São Jorge da Mina was established. However, by that time Ceuta and Tangier had both become Bishoprics in 1417 and 1469 respectively and continuing the reconquest was seen as being more symbolically important. North Africa was seen as a major training ground for nobles, particularly lesser nobles, as it prepared them for war, but also kept young noble officers away from Lisbon, making any sort of noble revolt less likely. Additionally, for lesser nobles, fighting in North Africa was a way to gain access to money and prestige. Plundering the countryside towns outside of the fortresses became an instant source of wealth, as horses and other livestock could be sold.
By the 16th century the wars in Morocco were becoming costly, and several kings sought ways with which they could somehow abandon the North African possessions. This only worsened once Morocco was united by the Saaidi. The church was opposed to this, and for that reason it was difficult to accomplish. This seems to have been the major obstacle. As a result, by the mid-16th century new costly fortresses were built in and around Ceuta, Tangier and Mazagão. They fortresses proved to be far safer to the siege tactics of the Saaidi Sultans, but remained dependent on the sea and were enclaves surrounded by hostile territory. As a result, after the loss of Ceuta in 1640 the Portuguese government was only too willing to give away Tangier and Mazagão as part of a dowry.