The first railways in Libya consisted of a little over 200km of narrow (960mm) gauge lines radiating from Tripoli, constructed in 1912 by the then Italian colonial government. A further group of narrow gauge lines emerged around Benghazi, and was later extended. The last of these lines closed in 1965. A standard gauge line was constructed from Egypt as far as Tobruk during World War II but closed in 1946.
Around 1998, plans were announced for the opening of a new railway system, starting with a line from Tripoli to the Tunisian border. In 2001 it was reported that 60% of the earthworks were completed; however, these reports may have been somewhat optimistic. In any event, the project languished and no further progress was made.
In 2009, the Italian government gifted a modern 4-car diesel train to the then president of Libya, Colonel Muammar Gaddafi, to mark the 40th anniversary of his accession to power. The train had been built in Italy by AnsaldoBreda as part of an order for Danish State Railways; it was placed on a 3km section of new track specially constructed in the southwest outskirts of Tripoli. Satellite imagery dated 2020 shows the train still in the same location.
Around 2008 contracts were let with Russian and Chinese companies for the construction of several new standard (1435mm) gauge railways. In 2010, it was reported that the first 14km of a 554km line from Sirte to Benghazi was complete. However, all construction ceased and contracts lapsed with the Revolution of 2011 and subsequent civil war. In 2013, negotiations began with Russian Railways for the resumption of work. These negotiations were cut short by a renewed outbreak of civil war, since when Libya has had no single authority in control of the entire country.
In 2020, the Egyptian government announced plans for a line connecting the Egyptian rail network at Sallum with Benghazi. The line would in part follow the route of the former railway between Sallum and Tobruk.