The history of Liepaja is rooted in deep antiquity. The settlement is first mentioned in historical documents in the year 1253 under the name Līva in a land division treaty between the Bishop of Riga and the Livonian Order. The name likely derives from the local Līva River or the Livonian word "liiv", meaning "sand".
The transformation of a small settlement into a significant city was facilitated by its unique geography: the city emerged on a narrow strip of land between the Baltic Sea and Lake Liepaja. A natural harbour at the river mouth created ideal conditions for shipping, while its advantageous location allowed for the control of maritime routes, promoting the export of grain, timber, and amber. A decisive stage was receiving city rights in 1625, when Friedrich Kettler, Duke of Courland and Semigallia, signed the charter granting these privileges.
Initially, Liepaja developed as a modest fishing village inhabited by Curonians. However, in the 17th century, under the aegis of the Duchy of Courland, a true economic flourishing began. A canal was dug connecting the lake to the sea, which allowed for the creation of a full-fledged port. This event attracted artisans and merchants, definitively shaping the city's image as a bustling trade centre with strong Western European cultural influence.