After the Swedish Wars in the 17th century the town suffered from losing its foreign export privileges and from competition from Fredericia on the other side of the belt, which not only had a ferry link to Strib but levied customs duties on traffic through the Little Belt. In the 18th century income from porpoise catches diminished but in the 19th century, with the establishment of its own harbour in 1836, conditions improved thanks in particular to the growing trade in agricultural products from the surrounding areas. From the mid-19th century small industries started to develop, especially the iron foundry. The rail link between Middelfart and Nyborg opened in 1865, bringing added prosperity despite the fact that it connected with the ferry from Strib rather than the one from Middelfart.