History of rail transport in Canada
The history of rail transport in Canada began in the early 19th century. The Canadian railway system saw several expansion "booms" throughout history, as well as a major change from broad to standard gauge which occurred in the 1870s. An initially disconnected system was gradually integrated with the American railway network, as Canadian and American railway companies built lines and bought smaller companies in each other's country. The Intercolonial Railway, a product of Canadian Confederation, was Canada's first major experiment in railway nationalization, and following Confederation, several transcontinental railways were built. Many  Canadian railways were gradually brought together under large conglomerates, but by the end of the First World War, the sudden and decisive financial collapse of these conglomerates created a deep threat to Canadian infrastructure and economy, leading to their nationalization under the Dominion government. This nationalization and consolidation process produced the Canadian National Railways (CNR), which was owned by the Canadian federal government until 1995. The Great Depression led to a decline in rail traffic, and the sudden reversal of this during the Second World War left railways with overtaxed, aging, and poorly-maintained infrastructure. Toward the end of the  1950s, railways began to transition toward diesel trains. Ridership on passenger trains declined postwar, leading to railways to pursue their abandonment. Nationally, most passenger services were transferred to a new crown agency, Via Rail. Early tramways. Canada coalesced into a state following millennia of First Nations habitation, as well as centuries of habitation by European settlers. Different parts of the country were settled at different times, with their transport systems laid out in reflection of the era. Early transport patterns of indigenous peoples and voyageurs followed large natural waterways such as the Great Lakes waterway system, the Saint Lawrence River , and the Ottawa River. This was suitable for the fur trade, which involved the transport of light, high-value commodities by boat early in its history. The earliest recognizably railway-like system in recorded Canadian history was an industrial tramway on Cape Breton Island, which is said to have been built around 1720. The existence of a tramway, as opposed to simply a road, is poorly attested in written and archaeological records, but was present in local oral history in the early 20th century. This tramway has been cited in various sources as an example of a pre-steam railway  in North America, despite a lack of evidence confirming its existence. Remaining physical evidence has led to the belief that it was used for transporting coal to the Fortress of Louisbourg from mines on the island, during a period when the island was under French control. There is also some speculation that it was used in the construction of the fortress. Several other tramway systems were constructed before the 1830s. The first was a combined wagonway and incline tramway near Niagara Falls along what is now the American side of the Canada–United States border. It was built by the  British in 1762 near the end of the French and Indian War. The challenging geography of the Niagara Peninsula meant that until the later construction of canals, there was no navigable water route between Lake Ontario and Lake Erie, so transport between the two required the use of a portage. The French had long sought to take control of the portage trail from the Seneca, who had taken control of it from the Neutral Nation in the mid-17th century, amidst the Beaver Wars. The French tried to control this key point with repeated military expeditions and fortifications throughout the 17th  and early 18th centuries, including Fort Conti in 1679, Fort Denonville in 1687, and Fort Niagara in 1726. The British gained control of the portage by the 1760s, but their efforts to replace the system of Seneca porters with a tramway met with resistance from the Seneca. The situation erupted in violence with the Battle of Devil's Hole, a part of Pontiac's War. A warband of several hundred Seneca ambushed a British wagon train, massacring many of the teamsters and their soldier escorts. The British ultimately retained control of the portage and continued to use and maintain its  tramway until their surrender of the land to the United States following the Treaty of Paris in 1783. Another recorded incline tramway system was in Quebec City and was constructed in the 1820s, possibly as early as 1823. It marked several firsts in Canada: it was the first known double-track railway, the first steam-powered railway, and the first railway system known to have carried passengers regularly. It was built on Cap Diamant to haul stone and other construction materials for the Citadelle of Quebec up from a wharf below. The tramway was powered by a stationary steam engine  and was a permanent structure that operated until the late 1840s, when it was shut down due to its inconvenient location. Throughout the construction of the citadel, the general public was allowed to ride it as passengers, making it technically one of the earliest railways in Canada to carry passengers. A similar system, the Old Quebec Funicular, was later built in 1879 in a different location in the city. First railway boom. The first Canadian railway, the Champlain and St. Lawrence Railroad, was opened in 1836 outside of Montreal, a seasonal portage railway to connect river traffic. It was followed  by the Albion Railway in Stellarton, Nova Scotia in 1840, a collier railway connecting coal mines to a seaport. Heavy expansion of the rail system did not get under way until the "Railway Guarantee Act" of 1849 that guaranteed bond returns on all railways over 75 miles. This led to rapid expansion of railway in the Canadas, sometimes excessive growth as uneconomic lines were built since the government guaranteed profits. However, this proved disastrous for government finances, and the Canadas were all but bankrupted by the subsidies. The largest rail project of this period was also a disaster. The Grand  Trunk Railway linking Montreal to Sarnia was finished in 1860, but was vastly mired in debt. In exchange for bailing out the company the government escaped its guarantee on the railway bonds. Transcontinental expansion. Canadian Confederation was in part brought about by the railways. The local governments had all but emptied their treasuries building railways, and a new and more stable method of financing them was required. It was also believed that union would allow for the needed construction of railroads linking British North America. The Maritimes joined largely because of promises to build the Intercolonial Railway, and British Columbia  only because of a promise to build a transcontinental railroad. The government had learnt its lesson and these railways were not funded by guarantees. Rather, the construction of the Intercolonial was fully controlled by the government under the direction of Sandford Fleming. The railway to the Pacific, the Canadian Pacific Railway (CPR), was financed by private funds and through massive land grants in the Canadian prairies, much of it of little value until the railway arrived, $25 million in cash and a guaranteed monopoly. The railway, then the longest in the world, was completed in 1885 to great fanfare . The booming Canadian economy after 1900 led to plans to build two new transcontinental railways. The Canadian Northern, a successful system covering the northern part of the prairies, and the Grand Trunk (through its Grand Trunk Pacific subsidiary) both launched ambitious plans to expand. The government at first encouraged the two to come to some arrangement and only have one new line, but in the end no agreement was made and the government supported the expansion of both lines. The federal government itself built the National Transcontinental Railway, a line from Moncton to Winnipeg, passing through the vast and uninhabited  hinterland of the Canadian Shield. Nationalization effort. This aggressive expansion proved disastrous when immigration and supplies of capital all but disappeared with the outbreak of the First World War. The Canadian Northern, Grand Trunk Pacific, and Grand Trunk were nationalized by the federal government, which absorbed the debt of over two billion dollars. All three railways, along with the Canadian Government Railways (formed by the Intercolonial, National Transcontinental, and several smaller lines) were then merged into the Canadian National Railways in 1923. The years after the First World War saw only moderate expansion of the rail network and the age  of the great railways were over in Canada. The automobile provided strong competition by the 1920s, and after the Second World War most passenger service was lost to airlines. The Canadian National Railways was one of the earliest diesel train operators in North America. The CNR experimented with self-propelled "oil-electric" cars starting in 1924. Diesels slowly became more prominent as yard switchers in the following decades. A prominent debut of diesel railway locomotion in Canada was in 1929, when CN No. 9000, built by the Canadian Locomotive Company using diesel engines imported from Britain, was used on the  International Limited, the flagship train of the former Grand Trunk Railway. Postwar period. The "National Transportation Act" of 1967 was an attempt at comprehensive transportation reform. It provided government subsidies for branch lines and passenger services, which at the time were still operated primarily by Canadian National and Canadian Pacific. In 1978, Canadian National passenger services were transferred to a new federal agency, Via Rail. CN was privatized in November 1995.