The town was annexed to the Austrian Empire in 1797; but during the years from 1806 to 1814, when it was ceded to the Napoleonic Empire. On 22 February 1812, the Battle of Pirano was fought between a British and a French ship of the line in the vicinity of Piran. This was a minor battle of the Adriatic campaign of the Napoleonic Wars. The French "Rivoli" had been recently completed at Venice. The French naval authorities intended her to bolster French forces in the Adriatic, following a succession of defeats in the preceding year. Captain John Talbot of HMS "Victorious" arrived off Venice in mid-February and blockaded the port. When the "Rivoli" attempted to escape under the cover of fog, Talbot chased her and forced her to surrender in a five-hour battle, the "Rivoli" lost over half her crew as either wounded or dead. This was the only battle ever fought in the sea nowadays belonging to Slovenia.