The k.u.k. Kriegsmarine was not formally established until the 18th century, but its origins can be traced back to 1382, with the incorporation of Trieste into the Duchy of Austria. During the 13th and 14th centuries, Trieste became a maritime trade rival to the Republic of Venice, which occupied the Adriatic port city for intermittent periods between 1283 and 1372. Under the terms of the Peace of Turin in 1381, Venice renounced its claim to Trieste and the leading citizens of Trieste petitioned Leopold III, Duke of Austria, to make the port part of his domains. The agreement incorporating Trieste into the Duchy of Austria was signed at the castle of Graz on 30 September 1382.