Francesco served the Republic of Venice in numerous official capacities—as ambassador, president of the Council of Forty, member of the Council of Ten, inquisitor, Procurator of St Mark's, "avogador de comùn"— before he was elected in 1423 defeating the other candidate, Pietro Loredan. His task as doge was to lead Venice in a long and protracted series of wars against Milan, governed by the Visconti, who were attempting to dominate all of northern Italy. Despite the justification of Venetian embroilment in the terraferma that was offered in Foscari's funeral oration, delivered by the humanist senator and historian Bernardo Giustiniani, and some victories, the war was extremely costly to Venice, whose real source of wealth and power was at sea. Venice, which during Foscari's leadership abandoned her ally Florence, was eventually overcome by the forces of Milan under the leadership of Francesco Sforza. Sforza soon made peace with Florence, however, leaving Venice alone.