Upon leaving Milan, Leonardo and Pacioli traveled to Mantua, where Leonardo worked briefly on a portrait of the generous if overbearing patron of the arts, Isabelle d'Este; he never finished the work, despite frequent and nagging letters from Isabelle over the course of the next five years.
In 1500, Leonardo continued to Venice. The 1499 French invasion of Lombardy and Sforza's attempt to mount a counter-attack out of exile had embroiled much of the Mediterranean coast in war. Venice itself was currently at war with the Ottoman Empire. Leonardo went to the Senate of Venice and offered his services as an engineer. He wanted to construct a kind of mobile dam that would allow Venetian forces to draw the Turks into the Isonzo river valley and then flood the valley, wiping out the enemy forces. The Senate did not act on his plan. He also had devised a diving apparatus, and wanted to initiate an underwater raid on the Ottoman fleet, drilling holes in the bottoms of their ships. His design was remarkably similar to modern scuba gear. Neither of these plans were ever acted on, and Leonardo was careful to keep the details of his designs secret, so as not to let them fall into the wrong hands.
By April, he had returned to Florence. He saw his father Ser Piero, who was by this time a wealthy man of 74, living with his fourth wife. Leonardo took up lodgings with the Servite friars of Florence, hoping to find a patron soon. He agreed to paint an altarpiece for the friars, but it took months for him to begin. In the meantime, he undertook several architectural projects, and continued work in his notebooks on the collapse of buildings and building materials.
The altarpiece for the friars was to be a painting of the Virgin and Saint Anne, following the then current vogue for St. Anne, Mary's mother; at the time there was much discussion of an apocryphal passage which claimed that St. Anne was also a virgin mother. By 1501, Leonardo had begun work on the cartoon, or preliminary drawing. The painting itself was never finished, although he worked on it from time to time over the years. This painting is perhaps more beautiful incomplete than it would be complete. The Virgin, bending down, sits with her mother St. Anne. Anne's face is dark and mysterious, as if she is going to tell the fate of Jesus, while Mary remains warm and content. Mary seems anxious to keep the Child with her, although the child seems to be already interested in tending "his flock."
In 1502, Leonardo finally got his chance to act as a military engineer. In 1502, Cesare Borgia (who Leonardo had probably met Leonardo in Milan), was commander of the pope's army. He had nearly subjugated all of central Italy, the Romagna. In the late summer of 1502, Borgia took on Leonardo as his chief military engineer. Leonardo traveled the Tuscan coast, inspecting fortifications and draining marshes. He then traveled all over the Romagna, finally ending up in Imola. There, Borgia set up his winter quarters. The city was heavily fortified as attack was expected.
At Imola, Leonardo probably met Niccolo Machiavelli, who he would see again in Florence the next year. Leonardo probably got along well with Borgia: both were both ambitious, illegitimate, unconventional men. In addtion to his official military duties, while at Imola Leonardo drew what is perhaps the first directly overhead map of a city. Typical maps of the time assumed a vantage from an angle, a bird's eye view.