The area was inhabited by the Mpongwé tribe long before the French acquired the land in 1839.
In 1842, American missionaries from New England established a mission in Baraka, Gabon, on what is now Libreville. In 1846, the Brazilian slave ship L'Elizia, carrying slaves from the Congo, was captured near Loango by the French navy which was tasked with contributing the British Blockade of Africa. Fifty-two of the freed slaves were resettled on the site of Libreville (French for "Freetown") in 1849. It was the chief port of French Equatorial Africa from 1934 to 1946 and was the central focus of the Battle of Gabon in 1940.
In 1910, French Equatorial Africa (Afrique équatoriale française, AEF) was created, and French companies were allowed to exploit the Middle Congo (modern-day Congo Brazzaville). It soon became necessary to build a railroad that would connect Brazzaville, the terminus of the river navigation on the Congo River and the Ubangui River, with the Atlantic coast. As rapids make it impossible to navigate on the Congo River past Brazzaville, and the coastal railroad terminus site had to allow for the construction of a deep-sea port, authorities chose the site of Ponta Negra instead of Libreville as originally envisaged. Construction of the Congo-Ocean Railway began in 1921, and Libreville was surpassed by the rapid growth of Pointe-Noire, farther down the coast.
Libreville was named in imitation of Freetown and grew only slowly as a trading post and a minor administrative centre to a population of 32,000 on independence in 1960. It only received its first bank branch when Bank of West Africa (BAO) opened a branch in 1930. Since independence, the city has grown rapidly and now houses nearly half the national population.