From 1283 to 1797, the town became part of the Republic of Venice, where it was governed in a semi-autonoumous way, with a council of local noblemen assisting the Venetian delegate. Several enemy (e.g. from the Republic of Genoa) and pirate assaults were repelled during the late Middle Ages; a great pestilence hit the town in 1558, killing about two thirds of the population. The last decades of Venetian rule were marked by decadence, due to the competition with the nearby Austrian port town of Trieste.