The history of Gothenburg begins with the foundation of the heavily fortified town in 1621, during the Thirty Years' War, when Sweden was once-again in armed conflict with Denmark–Norway. The location of the new trading port, Sweden's only direct access to the North Sea and Atlantic, was highly strategic: the result of centuries of conflict with the Norwegians just to the north, in Bohuslän, and the Danes, just to the south in Halland.
The region on the west coast of Sweden has been inhabited for several thousands of years. During the Stone Age, there was incidentally a settlement right on present day Gothenburg. As a reminiscence, there are eleven rock carvings in the Gothenburg area.
The predecessor of present-day Gothenburg was Lödöse, 40 kilometers upstream from the present day city on the Göta River, which served as trade centre and port to the west in the Middle Ages. However, Lödöse had problems further down the river – at the Bohus Fortress (present day Kungälv) the Norwegians and the Danes could control the ships to and from Lödöse, and in 1473 the town was moved into a new location called Nya Lödöse (New Lödöse, where the present day suburb Gamlestan in Gothenburg is today). But the new settlement also had its problems, and the town dwellers had to seek protection at the old Älvsborg Fortress.
King Gustav Vasa tried to build a new city near the old Älvsborg Fortress, but was not successful. When Sweden rose to be a major European power in the 17th century, his son King Charles IX founded a town on the northern bank of the Göta älv and near the outlet to the sea, on the island Hisingen. This was the first time that the town was named Gothenburg.