By 1665, the Portuguese Restoration War had been raging for 25 years. Despite numerous setbacks, King Philip IV of Spain was determined to crush the Portuguese insurrection. After a disastrous campaign in Southern Portugal culminated in the 1662 Battle of Ameixial, the Spanish court re-evaluated the performance of the Spanish Army and came to the conclusion that the war could only be ended by decisive action. The court believed that the Portuguese insurrection could only be ended by the capture of a major Portuguese city or by the complete destruction of the Portuguese Army. Luis de Benavides Carrillo, Marquis of Caracena, a veteran of campaigns in Italy and the Netherlands, was appointed to lead the new invasion of Portugal. Carrillo had served as a field commander and as a military governor, and his organizational skills were lauded. Carrillo planned to end the war by capturing the Portuguese capital of Lisbon. To reach the city, he planned first to take Vila Viçosa, followed by Setúbal.