The French capture of San Sebastian, 5 March 1808, was one of a series of surprise attacks on Spain’s border fortifications that marked the beginning of the French invasion of Spain. At the start of 1808 France and Spain were officially Allies, and had been cooperating on the invasion of Portugal. This meant that a large number of French troops were already inside Spain, but if Napoleon was to carry out a full scale invasion of the country then he needed to capture the Spanish border fortresses, which would otherwise pose a serious threat to his lines of communications.
The fortress of San Sebastian was located at the Atlantic end of the Pyrenees. Unlike the other main fortresses, San Sebastian did not fall to a French trick. The Spanish government was desperate to avoid a war with France, and so the governor of San Sebastian was under orders not to offer military resistance to the French. Accordingly, when on 5 March the French commander in front of San Sebastian threatened to launch an assault on the fortress, the governor had no choice but to surrender.