Rijeka, or Fiume, located on the Kvarner (Quarnero) Gulf, an arm of the Adriatic Sea, about forty miles (sixty kilometers) southeast of Trieste, is the principal seaport and the third-largest city in Croatia (after Zagreb and Split).
Because of its strategic position and its excellent deep-water port, the city has been fiercely contested over the centuries, especially among Italy, Hungary, and Croatia, changing hands and demographics many times.
Traces of Neolithic settlements can be found in the region, but the earliest modern settlements on the site were Celtic Tharsatica (modern Trsat, now part of Rijeka) on the hill, and the tribe of mariners, the Liburni, in the natural harbor below.
The city long retained its dual character.
Pliny mentioned Tarsatica in his Natural History (iii.140).
In the time of Augustus, the Romans rebuilt Tharsatica as a municipium Flumen, situated on the right bank of small river Rječina (whose name means "the big river").
It became a city within the Roman Province of Dalmatia until the sixth century.
Rijeka after the fourth century was rededicated to St. Vitus, the city's patron saint, as Terra Fluminis sancti Sancti Viti or, in German, Sankt Veit am Pflaum.
The town from the fifth century onward was ruled successively by the Ostrogoths, the imperial Greeks, the Lombards, and the Avars.
Croats settled the city starting in the seventh century, giving it the Croatian name, Rika svetoga Vida ("the river of St. Vitus").
At the time, Rijeka was a feudal stronghold surrounded by a wall.
At the center of the city, its highest point, was a fortress.
Rijeka was attacked in 799 by the Frankish troops of Charlemagne.
Their Siege of Trsat was at first repulsed, during which the Frankish commander Duke Eric of Friuli was killed.
The Frankish forces finally occupied and devastated the castle, however, while the Duchy of Croatia passed under the overlordship of the Carolingian Empire.
The town from about 925 was part of the Kingdom of Croatia, from 1102 in personal union with Hungary.
Trsat Castle and the town was rebuilt under the rule of the House of Frankopan.
The Rijeka citizens in 1288 signed the Law codex of Vinodol, one of the oldest codes of law in Europe.
Rijeka is a rival to Venice by 1466, when the city is purchased by the Habsburg emperor Frederick III, Archduke of Austria.
It will remain under Habsburg overlordship for over four hundred and fifty years.