It unexpectedly gained independence in 1440 after Pope Eugene IV, embroiled in a struggle with the Council of Basel, made a sale of territory to the Republic of Florence. By error, a small strip of land went unmentioned in the sale treaty and its inhabitants promptly declared themselves independent.