Siege of Tangier (1463–1464)
The Siege of Tangier (1463–1464) was an attempt by the Portuguese, led by Afonso V of Portugal to capture the city of Tangiers. The expedition ended in failure.

Siege
After the capture of Ksar es-Seghir, the victory animated Afonso to prepare for another expedition. This time, they aimed to capture Tangiers. In November 1463, the king sailed to Africa and landed there. Afonso then attacked the city. However, it was repulsed. This was due to the removal of Duarte de Meneses, 3rd Count of Viana, who was in rivalry with his brother-in-law Pedro de Meneses, to whom he had the highest sovereign. Afonso then rebuked several of his noblemen for not allowing Duarte to speak up; otherwise, things would have gone better. A second assault was launched, this time by Ferdinand, Duke of Viseu in January 1464. Afonso had already left Tangiers for Ceuta. Ferdinand ignored the advice of Duarte in fear that Duarte might take all the glory of the conquest. The assault failed again. Another attempt was made on January 19, but was likewise repulsed.  After the siege, the Moroccans took some prisoners. When the Moroccans began to examine the dead bodies of the Portuguese in an attempt to find Duarte, a Portuguese prisoner told him he was not here.

Aftermath
Afonso learned of the defeat at Tangiers, which filled him with dismay, and he resolved to return home. However, four Moroccans with treacherous characteristics told Afonso that if he made a raid on a neighboring mountain in Ceuta, he would achieve considerable spoils. Afonso took their word and, with a force of 800 cavalry and a small number of infantry, raided the place. Being drawn into the passes, he was ambushed by the Moroccans. Most of his knights, including Duarte, were killed, and the king barely escaped from this disaster. The raid took place in February.

Bibliography
S. A. Dunham, The History of Spain and Portugal, Vol III, p. 271-2 
H. Banquero Moreno, A Batalha de Alfarrobeira. Antecedentes e Significado Histórico. Vol. II, p. 880-1

References

Conflicts in 1464
Portuguese colonisation in Africa
1464 in Portugal
Sieges involving the Marinid Sultanate
Sieges involving Portugal
15th century in Morocco
Morocco–Portugal military relations