Construction began during World War I and the plan was to connect Serbia with Austro-Hungary, which occupied both Serbia and Bosnia and Herzegovina at the time. Šargan was located away from the pre-war border. The Austrians hastily piled the materials needed for the construction and enlisted numerous Russian and Italian prisoners of war in order to speed up the construction as they were in the hurry. Plans were drafted in 1916 and the original, Austrian route differed from the later finished one. They were planning to connect the final station on the Bosnian side, Donje Vardište, to Užice, final statrion on the Serbian side, which was reached by the railway in 1912. The originally projected route went through the upstream depression, gorges and defiles, or roughly where today the Užice-Višegrad road goes today. It was to swirle along the river almost to the top of Šargan. Digging was extremely hard. Despite so many water sources, the slopes of the Šargan were barren and infested with snakes. The local population called the mountain rocks kremenjak as it sparks when hit by the pickaxe. Originally, works started along the river, and was several meters above the present route, as evident by the remaining bridge across the Beli Rzav at Kotroman. The original, higher bridge, was built by the Austrians and demolished when the railway was finished after the war and the lower bridge was built, leaving the concrete foundation of its right section. The lower bridge was demolished by the occupational German forces during their withdrawal in the late 1944. From the station in Mokra Gora, the Austrians conducted the railway across the. Despite begging from the local population to leave the cemetery alone, Austrian engineers and technicians were marking the route by digging wooden sticks next to the graves and tombstones. They were followed by the workers who were then digging the remains out of the graves. The cemetery is split in two, and remained so to this day, though the tracks were never operational. From the cemetery, tracks continue to lead along the valley of the Kamešina river and then disappear. Next to this ending are walls, which were used to dam the river. Tracks resurface later, continuing up the Šargan, reaching the Budim hill. In 1916, after an explosion during the digging of the "Budim" tunnel, the ceiling collapsed killing the entire shift of workers. Between 150 and 200 Italian and Russian prisoners were killed. After this, the Austrians quit further works on the construction of the railway.
Yugoslavia
The works were halted and were only continued in 1921, in the newly formed Kingdom of the Serbs, Croats and Slovenes. The construction of the railway was completed in 1921. A descent of was surmounted with the tracks which curve in the shape of 8, hence the name. The track is long and due to the curvature, on some sections the train passes twice through the same points. In total, there are 22 tunnels on the route. The entire area is abundant in water, which gave name to the village Mokra Gora. There are 365 known water springs along the route. The water is literally dripping down the tunnel walls. The former East Bosnian railway with a gauge of was an important part of the former narrow-gauge main line from Sarajevo to Belgrade and closed in 1974. Between 1999 and 2003 the section over the Šargan pass was rebuilt by the Serbian Ministry of Tourism and the Yugoslav state railway JŽ, now the Serbian railways with great help from Emir Kusturica, a famous film director who had the town of Drvengrad built for one of his movies.
21st century
As of 2017, the train popularly named "Ćira" but officially called "Nostalgia", still runs only on the route Mokra Gora-Šargan Vitasi-Mokra Gora, with occasionally running to Višegrad. During the snowy periods, it runs only from Mokra Gora to Jatare. In 2017 season it had 75,000 visitors, out of which 25,000 were foreign tourists. Attractions include the restaurant carved into the rock at Šargan and a rock named "crazy stone" at Golubići, which "invokes love". In the 2019 season, number of visitors grew to 88,000. In 2019 reconstruction of the tunnels began. Works should be finished by 2021, a centennial of the railroad.