The Grand Canal seen from the bridge at Ponte di Rialto
Beginning as early as AD 166 to 168, the Quadi and Marcomanni destroyed the main center in the area, the current Oderzo. The Roman defences were again overthrown in the early 5th century by the Visigoths and, some 50 years later, by the Huns led by Attila. The last and most enduring immigration into the north of the Italian peninsula, that of the Lombards in 568, left the Eastern Roman Empire a small strip of coast in the current Veneto, including Venice. The Roman/Byzantine territory was organized as the Exarchate of Ravenna, administered from that ancient port and overseen by a viceroy (the Exarch) appointed by the Emperor in Constantinople, but Ravenna and Venice were connected only by sea routes; and with the Venetians' isolated position came increasing autonomy. New ports were built, including those at Malamocco and Torcello in the Venetian lagoon. The tribuni maiores, the earliest central standing governing committee of the islands in the Lagoon, dated from c. 568.
The traditional first doge of Venice, Paolo Lucio Anafesto, was actually Exarch Paul, and his successor, Marcello Tegalliano, was Paul's magister militum (General: literally, "Master of Soldiers"). In 726 the soldiers and citizens of the Exarchate rose in a rebellion over the iconoclastic controversy at the urging of Pope Gregory II. The Exarch was murdered and many officials put to flight in the chaos. At about this time, the people of the lagoon elected their own leader for the first time, although the relationship of this to the uprisings is not clear. Ursus was the first of 117 "doges" (doge is the Venetian dialect development of the Latin dux ("leader"); the corresponding word in English is duke, in standard Italian duce.) Whatever his original views, Ursus supported Emperor Leo III's successful military expedition to recover Ravenna, sending both men and ships. In recognition of this, Venice was "granted numerous privileges and concessions" and Ursus, who had personally taken the field, was confirmed by Leo as dux and given the added title of hypatus (Greek for "Consul".)
In 751 the Lombard King Aistulf conquered most of the Exarchate of Ravenna, leaving Venice a lonely and increasingly autonomous Byzantine outpost. During this period, the seat of the local Byzantine governor (the "duke/dux", later "doge"), was situated in Malamocco. Settlement on the islands in the lagoon probably increased with the Lombard conquest of other Byzantine territories, as refugees sought asylum there. In 775/6 the episcopal seat of Olivolo (San Pietro di Castello; Helipolis[citation needed]) was created. During the reign of duke Agnello Particiaco (811–827) the ducal seat moved from Malamocco to the highly protected Rialto, the current location of Venice. The monastery of St Zachary and the first ducal palace and basilica of St. Mark, as well as a walled defense (civitatis murus) between Olivolo and Rialto, were subsequently built here.
View of San Marco basin in 1697
Charlemagne sought to subdue the city to his own rule. He ordered the Pope to expel the Venetians from the Pentapolis along the Adriatic coast, and Charlemagne's own son Pepin of Italy, king of the Lombards under the authority of his father, embarked on a siege of Venice itself. This, however, proved a costly failure. The siege lasted six months, with Pepin's army ravaged by the diseases of the local swamps and eventually forced to withdraw (810). A few months later, Pepin himself died, apparently as a result of a disease contracted there. In the aftermath, an agreement between Charlemagne and the Byzantine Emperor Nicephorus in 814 recognized Venice as Byzantine territory and granted the city trading rights along the Adriatic coast.
In 828 the new city's prestige increased with the acquisition of the claimed relics of St Mark the Evangelist from Alexandria, which were placed in the new basilica. (Winged lions, visible throughout Venice, symbolise St Mark.) The patriarchal seat also moved to Rialto. As the community continued to develop and as Byzantine power waned, its autonomy grew, leading to eventual independence.
(source)