The city is first mentioned in 1072, and became an important river port in the 12 and 13th centuries, especially known for salt trade, under the counts of Gorizia. In the 12th century it became an autonomous commune, annexed by the Republic of Venice in 1420.