In late Antiquity the north-east of the Italian peninsula suffered many invasions. The wars caused people to move to the safer lagoon areas, and hence to the foundation of Venice.
The doge was the elected head of the Venetian Republic. He was elected for life by an arcane process that also included drawing lots.