From 1878, Višegrad, like all of Bosnia and Herzegovina, was under the control of Austria-Hungary. In 1906, after three years of construction, the Bosnian Eastern Railway was opened, giving the city a rail connection to Sarajevo and, from 1928, via Užice to Belgrade.
The line fell out of service after less than half a century, but a section between Mokra Gora and the mountain top at Sargan Vitasi was restored. The tourist trains that run there are pulled by two Class 83 D tender locomotives and two C tender locomotives. There are plans to restore the route to Visegrad. There is a second narrow-gauge railway in Mokra Gora.