The lands of the canton of Ticino are the last lands to be conquered by the Swiss Confederation. (After the battle of Marignano in 1515 the king of France Francis I defeated the Confederates, and they gave up any further conquests.) In February 1798 an attempt of annexation by the Cisalpine Republic was repelled by a volunteer militia in Lugano. Between 1798 and 1803, during the Helvetic Republic, the districts of Bellinzona and Lugano were separate cantons, but in 1803 the two were unified to form the canton of Ticino that joined the Swiss Confederation as a full member in the same year. During the Napoleonic Wars, many Ticinese (as was the case for other Swiss) served in Swiss military units allied with the French.