Founded during or before the time of the Roman Empire, the town came under successive Frankish, Croatian and Hungarian rule before coming under the control of the Austrian Habsburgs during the 15th century.
Created a free port in 1723, Fiume passed during the 18th and 19th centuries between the Habsburgs' Austrian, Croatian and Hungarian possessions until its attachment to the latter kingdom for the third and last time in 1870.
Major port development, the general expansion of international trade and the city's connection (1873) to the Hungarian and Austrian railway networks contributed to rapid population growth from 21,000 in 1880 to 50,000 in 1910.
Habsburg-ruled Austria-Hungary's defeat and disintegration in the closing weeks of World War I led to the establishment of rival Italian and Croatian administrations in the city as both Italy and the founders of the new Kingdom of the Serbs, Croats and Slovenes (the later Yugoslavia) claimed sovereignty over it.
After a brief Italian occupation, an international force of French, British and United States troops occupied the city (November 1918) while its future was discussed at the Paris Peace Conference during the course of 1919.
Italy based her claim on the fact that Italians were the largest single nationality within the city, though they remained a minority. Croats made up most of the remainder, and were also a majority in the surrounding area, including the neighbouring town of Sušak.
Negotiations were rudely interrupted by the city's seizure on September 12, 1919 by a force of Italian nationalist irregulars led by the writer Gabriele d'Annunzio, who established a state (the "Italian Regency of Carnaro") foreshadowing much of the later Italian Fascist system.
The resumption of Italy's premiership by the Liberal Giovanni Giolitti in June 1920 signalled a hardening of official attitudes to d'Annunzio's coup. On November 12, Italy and Yugoslavia concluded the Treaty of Rapallo, under which Fiume was to be an independent state under a regime acceptable to both.
D'Annunzio's response was characteristicly flamboyant and of doubtful judgment: his declaration of war against Italy invited the bombardment by Italian royal forces which led to his surrender of the city at the end of the year. Italian troops took over in January 1921.
The election of an autonomist-led constituent assembly for the territory did not put an end to strife: a brief Italian nationalist seizure of power was ended by the intervention of an Italian royal commissioner, and a short-lived local Fascist takeover in March 1922 ended in a third Italian military occupation. Seven months later Italy herself fell under Fascist rule.
A period of diplomatic acrimony closed with the Treaty of Rome (January 27, 1924), which assigned Fiume to Italy and Sušak to Yugoslavia, with joint port administration. Formal Italian annexation (March 16, 1924) inaugurated twenty years of Fascist rule, followed by twenty months of German military occupation.
The aftermath of World War II saw the city's fate again resolved by a combination of force and diplomacy. This time, Yugoslav troops advanced (early May 1945) as far west as Trieste in their campaign against the German occupiers of both countries: Fiume finally became the Croatian (and until June 1991, Yugoslav) city of Rijeka, a situation formalised by the Paris peace treaty between Italy and the wartime Allies on February 10, 1947.