The Trans-Iranian Railway (Persian: راه آهن سراسری ایران) was a major railway building project started in 1927 and completed in 1938, under the direction of the Persian monarch, Reza Shah, and entirely with indigenous capital. It links the capital Tehran with the Persian Gulf and Caspian Sea. The railway connected Bandar Shah (now: Bandar Torkaman) in the north and Bandar Shahpur (now: Bandar-e Emam Khomeyni) in the south via Ahvaz, Ghom and Tehran. During the land reforms implemented by Mohammad Reza Shah in 1963 as part of the "White Revolution" the Trans-Iranian railway was extended to link Tehran to Mashhad, Tabriz, and Isfahan.
The idea of a railway connecting Russia and India was proposed by several private Russian promoters in 1889, 1900, and 1905. However, the Russian government declined such proposals, fearing that it would jeopardize Russia’s geographically enabled commercial dominance in Iran as well as complicate relations with the British. In 1889 Russia and the Shah agreed that no railways could be built in Iran without the mutual consensus of the Russians. However, by 1910 the agreement was vetoed in the Iranian Constitutional Revolution. Fears that Russian interests were no longer primary, alongside the surfacing of anti-Russian political forces in the country, and the emergence of the German threat, made it more important than ever for the country to protect its commercial interests in Iran by building a railway.
In order for the railway to be built, the problem of raising enough capital to fund the project was discussed. The Russo-Japanese War of 1905 was one of several factors leaving Russia on a tight budget, preventing Russia from providing the funds. The British were solicited as well, but the request could not be granted, pushing back initiation of the railway’s construction further. Nikolay Khomyakov, President of the Duma, and I.A. Zveginstov, supporters of the Anglo-Russian Entente, promoted a private initiative for a railway connecting India and Europe, to counteract the economic threat Germany posed to the region. Germany’s influence over the region was enabled by the Baghdad Railway, which connected Germany and the Ottoman Empire (modern-day Turkey, Syria and Iraq), enabling Germany to begin plans for connecting the railway to Tehran to increase its commercial enterprise. Despite opposition from the Russian Ministry of Foreign Affairs and Ministry of Finance, there was also a great deal of support for the project.
A Trans-Iranian Railway Consortium was formed by December 1910, consisting of twelve major Russian banks. Nine of these banks came to an agreement with major French banks in 1911, resulting in the crucial financial support needed to fund the railway. However, the final step needed to initiate the project was the support of the British, who wanted to restore financial stability in Iran but did not wish to be involved in the Trans-Iranian Railway Consortium through the proposed four to six million pound loan, proposed by Alexander Izvolsky, Imperial Foreign Minister 1906–10, and Sergey Sazonov, Foreign Minister 1910–16. Sazonov continued to urge for the loan, believing it to be the solution to prevent Persia from bankruptcy. Lord Curzon, British Viceroy of India, rejected the loan, suspicious that the Russians had an acquisitive eye on Britain’s precious Indian colony, provoking stark protest from Sazonov against the accusation. Finally, in 1912, the Russian, French, and British financiers formed a Société d'Etudes for the Trans-Iranian railway.
When Arthur von Gwinner, Chief Manager of Deutsche Bank and the Baghdad Railway, announced plans to build a section of the railway connecting Baghdad to Khanaqin by 1916, the Russians moved quickly to secure British support and French investments in the Société d'Etudes. The Russians were primarily concerned with the construction of the northern section of the line, extending from Astara to Tehran, while the British were more concerned with the southern section, since they already dominated the southern region and the Persian Gulf.
Meanwhile, the Balkan Wars in the Ottoman Empire (1912–13) created an unstable situation in the country, again putting off the initiation of the application. Such instability caused investors in the Société d'Etudes to hesitate in investing in a bankrupt Iran. Sazonov suggested that appointing a strong Iranian leader would aid the financial aspect of the railway project. Sa’d Dawla, former minister under former Muhammad Ali Shah, agreed to work with the two powers to use a grant from the Société d'Etudes[which?] and thus proceed with the construction of the Trans-Iranian Railway without the agreement of the newly formed parliament. However, Sir Edward Grey, Britain's Secretary of State for Foreign Affairs, refused to force the Iranians to accept Sa’d Dawla as Prime Minister, because of his aversion to the Constitutional movement in Iran.
The outcome of the Balkan Wars caused Russian and Britain to accept the probability of war between the Central Powers in the near future, suggesting the necessity of strong Anglo-Russian relations. Sazonov grew frustrated with Britain’s inability to compromise on a route incorporating India, and threatened to proceed with the northern route. Fearing the implications of the impending war, Grey at last found it in Britain’s best interest to concede at last, and agreed to initiate application of the railway under the Balmoral conditions.[clarification needed] By this time Britain already had further consolidated its control over the Persian Gulf.
By June 1914 surveys for the Enzeli-Tehran section had begun, and by 1915 the results of the Astara-Tehran part of the railway were completed and published. Still, progress on the railway was slow. However, a few days after the outbreak of World War I, Russia repudiated its obligation to build the Tehran-Khanaqin line under the Potsdam Agreement.
In the following years Reza who became Shah in 1925 had legislation passed in parliament which secured internal Iranian funding for the railroad project from taxes levied on consumption of sugar and other goods thus excluding a new round of external debts that had bogged down the rulers of Iran before World War I.
In further negotiations it was agreed first to construct 2 test lines starting from the northern and the southern end of the projected Transiranian Railroad in order to establish cost for an agreement on the whole line. Against competing interests from other countries the Americans decided to form a joint venture with German companies.
From 1927 an international syndicate called "Sindicat du Chemin du Fer en Perse" consisting of the American Ulen and Company and a German "Konsortium für Bauausführungen in Persien" (formed by 3 German companies Philipp Holzmann, Julius Berger and Siemens Bauunion ) undertook the construction of the initial test lines. The Americans brought the line from Bandar Shahpur via Ahvaz up to Dezful. The German group started from the new harbour of Bandar Shah on the Caspian coast to the foothills of the Alborz mountains at Shahi (Qaem Shahr). The Americans terminated their contract in 1930 after delayed payments by the government resulting from a conflict with Reza Shah.
In April 1933 Iran concluded a contract with the Danish firm Kampsax. Kampsax at that time was active in railway construction in Turkey and the Shah followed the Turkish recommendation which had the additional advantage of bringing in a company from a small country which posed no political risk for Iranian independence. Kampsax subcontracted the project in 43 lots to companies from Europe, the USA and Iran. Kampsax engineers supervised the works on each lot, the works being coordinated from the head office in Tehran. The contract required Kampsax to complete the line by May 1939. Kampsax completed the project under-budget and ahead of schedule, with it being formally opened throughout on 26 August 1938.
The first official steam locomotive conductor to ride the line was an Iranian named Hossein Orang. The first lines passed though formidable mountains. Long stretches have gradients of up to 1 in 36  and hillclimbing techniques such as railway spirals. The line is 1,394 km long, has about 230 tunnels and 4100 bridges and its highest point is at Arak, 2,220 m above sea level. However, Kampsax' contractors laid relatively lightweight rails, ranging from 67 to 75 lbs per yard, that restricted the axle loads that the line could carry.
Various geological problems were encountered, requiring abandonment of some tunnels and realignment of the route through different terrain:
The Three Golden Lines spiral is on the Mazandaran branch in the Sewatcow (Savadkuh) County of Mazanderan. The line ascends or descends in a short distance by passing three times in the same area at different heights. Trains descend towards Sari or ascend in the opposite direction by going through the Dowgal twin tunnels.
In 1936 Beyer Peacock supplied Iran with four Garratt 2-8-4 + 4-8-2 articulated locomotives (works numbers 6787–6890). In 1938 these became class 86.01. Until the British invasion of Iran in 1941 (see below, Anglo-Soviet invasion of Iran) these Garratts seem to have been the only standard gauge British locomotives in Iran.
German manufacturers supplied 65 steam locomotives for the opening of the line in 1938. 49 were 2-8-0 Consolidations: 24 from Krupp forming class 41.11, 16 from Henschel und Sohn forming class 41.35 and nine from Maschinenfabrik Esslingen forming class 41.51. The other 16 were Henschel 2-10-0 Decapods forming class 51.01.
The Trans-Iranian acquired 10 of the locomotives that Kampsax had used to build the line. These were Gölsdorf two-cylinder compound 0-10-0 freight locomotives built between 1909 and 1915 as Austrian State Railways class 80 by Wiener Neustädter Lokomotivfabrik, Lokomotivfabrik Floridsdorf and Lokomotivfabrik der StEG in Vienna and by Breitfeld-Daněk in Bohemia. When the Iranian railway introduced its new numbering system in 1938 the Gölsdorf 0-10-0s kept their original Austrian numbers.
After the substantial interruption of World War I, the project for constructing a railway across Iran was initiated by Reza Shah Pahlavi as part of numerous reforms contributing to the drastic modernization of Iran that occurred over the decades between World War I and World War II. Although technically independent, Iran was still a financially devastated and weak country. The first Iranian to ride the line was Hossein Orang . Yet the decade of the thirties brought the emergence of an economic market, a drastic increase in modern industries, a rise in exports, and an increase in agricultural output.
While it may seem logical to attribute the reduction in transportation prices to the Trans-Iranian Railway, in reality it contributed minimally. Initially, British and Russian observers considered the implantation of railroads as the ultimate solution to the immense transportation problems Iran faced due to sparsely settled population, the lack of rivers, high mountains, and inhospitable desert regions of the country. Many Americans and British opposed the Trans-Iranian Railway, suggesting more efficient and less expensive modes of transportation, such as the U.S. Army’s Motor Transport Service, which hauled about a fourth of the volume hauled by the railway to the Soviet border. Some British critics, including General Percy Sykes, opposed the railway because it ran north to south, rather than from west to east. The west to east route was preferred because it would allow the British direct access to their military bases in India and Mesopotamia, and at the same time, avoiding the threat of commercial loss of profit to Russia and any foreign rival. There were also Iranians opposed to the building of the railway as well, believing that the money could instead be much more effectively used on roads. However, if a cabinet minister was caught criticizing the extensive tax burden the railway produced, he could be placed in prison on counts of being a British collaborator, decidedly attempting to keep Iran backwards for his own financial and strategic goals.
Although much opposition to the railway was politically and financially motivated, the railway was an expensive tax-burden, costing Iran 2,195,180,700 rials through 1938-1939. The majority of capital used to fund the railway was provided through taxes on goods such as sugar and tea, produced in plants set up by the industries ministry, as part of Reza Shah Pahlavi’s reform movement.
The British and Russians initially stated their reason for invading Iran was the Iranian government’s failure to rid the country of Germans, who supposedly were planning an eventual coup d’etat. Yet there were other reasons for the invasion, and the Trans-Iranian Railways key location as part of the so-called “Persian Corridor” was one of the primary reasons for the Anglo-Soviet invasion of Iran in World War II. Despite Reza Shah’s attempts to remain neutral, the allies decided it would be most effective to remove Reza Shah from the throne, using his young son, instead to assist in their use of the Trans-Iranian Railway to transport oil to Britain, and supplies to the Soviet Union.
In August 1941 Soviet, British and British Indian forces invaded Iran to protect their oil supply in Iran and to  secure the Persian Corridor supply route from the Persian Gulf to the Central Asian republics of the Soviet Union. In September 1941 the Allies took over operation of the Trans-Iranian Railway: British and Empire Royal Engineers (RE) commanded by Brigadier Godfrey D. Rhodes operating the Southern Division between Tehran and the port of Bandar Shahpur on the Persian Gulf and the Soviet Army operating the Northern Division between Tehran and the port of Bandar Shah on the Caspian Sea.
The RE expanded freight capacity by building new railway yards at Bandar Shahpur, Ahvaz and Andimeshk and a junction at Ahvaz for a new line to Khorramshahr on the Shatt al-Arab. In order to increase the line's locomotive fleet the RE built a yard at Abadan to transfer locomotives from merchant ships to barges to take them up the River Karun and a derrick on a jetty on the Karun at Ahwaz to unload them from the barges onto the railway. When the British first took over the southern part in 1941, the railway was only able to move one freight train per day. The railroad hauled a total volume of 978 tons a day in the first quarter of 1942. Yet by September 1943, they were able to move 5,400 tons per day, due to the import of new locomotives, wagons, and more skilled individuals.
The Southern Division locomotive depot at Ahvaz had two German 2-10-0s, seven German 2-8-0s, two class 41.01 2-8-0s built by Beyer, Peacock & Co. in 1934, two class 80.14 0-10-0s from an Austrian locomotive builder and seven smaller locomotives. The RE found that all except the 2-10-0s were in poor condition, as was some of the freight rolling stock. In December dozens of LMS 2-8-0 steam locomotives and 840 20 ton freight wagons started to arrive from Britain. 27 coal-burning LMS 2-8-0s, designated class 41.100 in the Iranian State Railways numbering system, were in service by February 1942. Once enough LMS 2-8-0s were in service some of the German locomotives were released to increase the fleet on the Northern Division that the Soviets were operating. From February until August 1942 96 oil-burning LMS 2-8-0s, designated class 41.150, entered service on the Southern Division and by December 1942 another 19 class 41.100 coal-burners had joined them. In the same year Davenport Locomotive Works supplied 24 diesel-mechanical 0-4-0 switchers, designated class 20.01, that Iran had ordered before the Allied invasion.
In December 1942 the US Army Transportation Corps (USATC) replaced the British and Empire force operating the Southern Division. In 165 miles (266 km) the line has 144 tunnels, in which smoke and oil fumes created harsh working conditions for steam locomotive crews. A limited water supply throughout the route and the hot climate of the southern plains formed further difficulties for steam locomotive operation. The USATC therefore considered diesel-electric locomotives more suitable and requisitioned the 13 ALCO RS-1s built and had them converted to ALCO RSD-1 1,000 horsepower Co-Co locomotives. An additional 44 RSD-1s were built for use in Iran. These totalled only 57 locomotives so initially they were used to operate only the southern part of the Southern Division between Bandar Shahpur and Andimeshk.
For traffic between Andimeshk and Tehran the USATC brought 91 S200 Class steam locomotives, designated class 42.400 in the Iranian State Railways numbering system. The USATC also introduced another 3,000 freight cars. In April 1943  another 18 ALCO RSD-1's entered service, enabling the USATC to return some LMS 2-8-0s to the British Middle East Command and extend diesel operation northwards, reaching Qom by September 1943 and regularly serving Tehran by May 1944. The USATC further increased freight traffic so that in 1944 it averaged 6,489 tons per day.
"Aid to Russia" traffic ceased by May 1945 and in June the USATC withdrew its RSD-1's  and returned control to the British authorities. Shortly afterwards the British restored the line to Iranian State Railways, the predecessor to the Islamic Republic of Iran Railways.