of railway running between Tuttlingen and Immendingen, which had been replaced on the Gäubahn by the new section Tuttlingen-Hattingen, was assigned exclusively to the Danube Valley Railway (Donautalbahn, see Tuttlingen–Inzigkofen railway). The full length of the Gäubahn traversed the territory of all three of the states in the German southwest in the late 19th century. The section between Hattingen and Singen, which is shared with the Black Forest line, runs through Baden, and was built by the Baden State Railways. Between Tuttlingen and Stuttgart, the line travels through lands in Württemberg, and was constructed by the Royal Württemberg State Railways. In addition, the area claimed by the Province of Hohenzollern reached to the Neckar near Dettingen and Horb, which made the Prussian province an adjacent owner. It was the two former railway companies, however, who built the Gäu line. Construction of the Singen–Hattingen and Horb–Tuttlingen sections (1866–1869) The first parts of the line were built at its southern end in Singen, far removed from the eponymous Gäu, by the Baden State Railways. The railway engineer Robert Gerwig, who hailed from Baden, was in the planning stages of a railway, which would cross the Black Forest from Offenburg to Singen, and which would become the Schwarzwaldbahn (Baden). At the time, a connection to Württemberg was not considered. The first part of that line, between Singen and Engen, which was topographically without real challenges, was opened for service on 6 September 1866. The extension of that section to Donaueschingen proved to be technically much more complex, and the construction of the ascending part of the line between Engen and Donaueschingen was not completed until 15 June 1868. The section between Engen and Hattingen is shared with the Gäubahn. In Württemberg, the Royal Württemberg State Railways had started in the late 1850s to build a line that paralleled the Neckar river, and connected with the Fils Valley Railway in Plochingen. This line, which was dubbed the Upper Neckar Railway, reached Reutlingen in 1859, Rottenburg am Neckar in 1861, and Horb am Neckar in 1866. Extending this route to Rottweil did not present any real technical hurdles, but was politically sensitive, because the areas around Fischingen, Neckarhausen, and Dettingen belonged to the Province of Hohenzollern, which meant that the agreement of Prussia was required to continue construction. The treaty between Prussia and Württemberg of March 1865 solved the issues around the extension of construction