In 1662, Charles made a dynastic marriage with Catharine of Braganza; Tangier and Bombay were ceded to the British Crown and a military alliance was agreed to help Portugal who had been fighting to regain her independence since 1640. British troops under Frederick Schomberg were raised to serve to help fight the Spanish. Within a year the Spanish army attempted to overrun Portugal but at the crucial battle of Ameixial the Portuguese and British inflicted a crushing defeat.