The first railway line in Turkmenistan was opened in 1885 between Krasnovodsk (present day Türkmenbaşy) on the Caspian Sea and Ashgabat, extending to Chardzhou (present day Türkmenabat) the following year and to Samarqand (in present day Uzbekistan) by 1888. Construction of the line had commence when the region became part of the Russian Empire, as Transcaspia. Although initially planned as a narrow gauge line, it was completed to the Russian standard gauge of 1524mm (later 1520mm).
The line was isolated from the rest of the Russian network until 1905 when a train ferry service was inaugurated between Krasnovodsk and Baku (present day Bakı, Azerbaijan). An overland connection via Orenburg (Russia) was completed the following year, but the train ferry remained in use.
A short international link with Afghanistan was opened in the 1980s, but closed on the withdrawal of Soviet troops from that country in 1989. The link was reinstated in 2007; a second link opened in 2016.
Following the dissolution of the Soviet Union in 1991, border disputes with Uzbekistan led to the closure of the international rail link, leaving the train ferry to Azerbaijan as the only connection between the Turkmen network and the rest of the world. The Uzbek rail link remained closed for several years and has since been used only intermittently.
A international connection with Iran at Sarahs, involving a break of gauge with the standard gauge Iranian network, opened in 1996. A further connection at Etrek opened in 2013. There is also a short cross-border line serving the Iranian border facility at Loftabad, but this has no direct connection with the rest of the Iranian network.
An international link with Kazakhstan opened in 2012. Intially isolated, it was connected with the national main line in 2014, thus forming a through route between Kazakhstan and Iran.
Flag image from CIA World Factbook