York and Doncaster branch

The York and Doncaster branch was a railway line that opened in 1871 connecting Doncaster with York via Selby in Yorkshire, England. This line later became part of the East Coast Main Line (ECML) and was the route that express trains took between London King's Cross, the north of England and Scotland. It was opened by the North Eastern Railway (NER) between York and Shaftholme Junction, some 4.5 mi north of Doncaster railway station. Between its opening in 1871 and the grouping in 1923, the line was used by both the NER, and the Great Northern Railway (GNR). All of the intermediate local stations that had opened with the line in 1871 closed down in the 1950s and 1960s leaving just Selby open between the town of Doncaster and the city of York.

In the 1970s, a plan for extracting the coal from underneath the northern section of the line between Selby and York, led to British Rail building an avoiding line, the Selby Diversion, which fully opened to traffic in October 1983. The southern section of the line between Doncaster and Selby is still open to enable trains from Doncaster to access the East Riding of Yorkshire and Lincolnshire.

The trackbed of the line between Selby and York is now used partly by the A19 (as a bypass at Riccall), whilst the rest of the route forms part of the Trans-Pennine Trail and National Cycle Route 65.

History
At least two routes were available from the region of South Yorkshire northwards into York by the time that the York to Doncaster Branch was opened in January 1871. George Hudson had already promoted his venture, the York and North Midland Railway, whilst the Lancashire and Yorkshire Railway (L&Y) had their line which went through Knottingley. The L&Y were against the NER building what would be a shorter line (by 10.5 mi), between Doncaster and York as it would take traffic away from their line. Nevertheless, the plan was approved in March 1864, and despite some financial problems, the line opened to traffic in January 1871.

The Great Northern Railway achieved running powers over the line from the NER which allowed a mutually beneficial service for both companies. The GNR would run the long distance trains and the NER would operate the local services. As the new line connected with Shaftholme Junction, the section south from there to Doncaster was controlled by the GNR, so the NER needed their permission to run into Doncaster.

The works included an entirely new section of railway south from Chaloners Whin Junction, south of York, to Barlby Junction on the eastern side of Selby. The route then used the Hull and Selby line across the River Ouse on Selby Swing Bridge and into Selby railway station. The second part of the route was another new build going due south from Selby to Shaftholme Junction north of Doncaster. The whole route between York and Doncaster consisted of 2 mi from York to Chaloners Whin Junction (already in existence), 12.5 mi of new railway to Barlby Junction at Selby, 14.5 mi from Selby to Shaftholme Junction, and then the last 4.5 mi section to Doncaster on the existing GNR metals. The cost of the new railway was £239,500 in 1871.

There were no major engineering obstacles on the line apart from a swing bridge over the River Ouse at Naburn, just to the north of Naburn station. Built to a design by Thomas Elliott Harrison, it was constructed of wrought iron which had two sections spanning 176 ft. Only one of the spans was able to swing, this being the one that had a control tower on top of it. In the first few years of operation, the bridge would be swung open to allow the passage of river traffic, and would only be moved into alignment with the railway when a train was due to pass. During the National Railway strike of 1911, the bridge and its signal box were overrun with striking railwaymen. The military were sent in to retake the bridge. The span was fixed in place by British Rail in 1956 as river traffic lessened in favour of ports downstream.

Another bridge spanned the River Ouse at Selby, just east of the station. This was originally a bascule bridge, that was replaced in 1891 with a swing bridge. The 1871 line also brought a new build station and Selby became an important junction on the routes between London and Edinburgh, and also on the Transpennine route to and from Hull. The station at Selby had four through tracks, with the middle tracks having no platforms. The westbound and eastbound tracks were gauntletted over the bridge and were reformed from two lines over the bridge, to four on either side. The gauntletting was removed in 1960, 23 years before the old ECML branch through Riccall was closed because of the Selby Diversion.

In 1989, the route northwards via the Selby Diversion was electrified, whilst the former line to Selby northwards from Temple Hirst Junction remains un-electrified.

Stations
The York to Doncaster line served the following stations;

Aside from the express trains that used the route, the timetable from 1910 shows that the section north of Selby had eight stopping services per day, this had dropped by the 1930s, with three trains per day calling at all stations. In 1946, the Bradshaws timetable shows some six local trains per day each way, though only one stopped at all of the stations on the line.

Accidents

 * 18 May 1883 - The station master at Escrick station was crossing the line as a freight train was engaged in the shunting of the goods sidings. The driver of the train whistled and threw the engine into reverse, but it knocked the station master down and removed both his legs below the knee. A passing express was stopped and took the injured man to York, but he died before it reached its destination.
 * 8 September 1896 - The signalman at the Naburn Bridge control cabin, was found dead on the track with his body "horribly mangled". A resultant inquiry surmised that as he was walking to work along the railway track, he crossed to the other line to avoid a train when he was hit by another train coming the other way.
 * 16 July 1952 - Riccall Gates Crossing was worked by one man who opened and closed the gates as well as setting the signals. The job was demanding because of the traffic, but also because the busy A19 was the road that used the crossing. The crossing keeper also had to communicate with the signal boxes which were next up and down the line and to manage the demands of the busy road traffic on the A19, who were impatient to get on their way. One car driver who parped his horn after a goods train had passed, was killed along with his wife when the confused signalman allowed him to start across the level crossing. On realising that a train was approaching from the north, the signalman waved his arms in a gesture which one witness said was encouraging the driver to speed up. Instead, the driver stopped on the level crossing and his car was crushed. The signalman was later found to have been negligent in his duties as he was discussing the cricket with a friend in the signal box whilst working the signals and the gates across the busy road. He was later jailed for manslaughter.
 * 15 November 1980 - a car drove around the automatic half Barriers of Riccall Turnhead Crossing just after midnight. An overnight container train heading south from Edinburgh was approaching the crossing and the driver of the locomotive testified that he saw the red lights of the crossing flashing and the barriers were down. For some reason, the car was driven around the barriers and the driver of the train observed the cars' headlights shine towards him, and then away from him, as it tried to negotiate its way around the barriers. The two occupants of the car were killed.
 * 28 February 2001 - the Great Heck rail crash. A Land Rover vehicle crashed off of the M62 motorway and onto the railway line at Great Heck. The vehicle was hit by a southbound passenger train, which derailed the train. The wreckage was then hit by a freight train carrying a load of coal weighing 1,800 tonne going northwards. Ten people died with over 80 being injured. The Land Rover driver was later sentenced to five years in prison on ten counts of causing death by dangerous driving, as it was proven in court that he had fallen asleep at the wheel.

Partial closure
In the 1970s, British Coal set about developing a working coalfield (the Selby Coalfield) to the north of Selby. To avoid subsidence on this section of line, a 14.5 mi diversion (the Selby Diversion) was opened between Temple Hirst Junction, just south of Temple Hirst railway station and Colton Junction, some 6 mi south of York railway station. Both junctions were new to the railway and the whole cost of the project was £60 million, which was paid for entirely by British Coal. This was seen as a good compromise as the estimated value of the coal underneath the railway was thought to have been worth over £1,000 million.

At its furthest point away from the original formation, the Selby Diversion was still only 5 mi west of Riccall.

The stretch of trackbed between the sites of Riccall railway station and Barlby Junction is now the site of at the widened A19 road. The section between Riccall and York now forms part of the Trans-Pennine Trail, and the National Route 65 which Sustrans purchased for the price of £1. The route has a scale model of the solar system, with each planet staggered along the path at the correct proportional distances from each other. The swing bridge at Naburn also has a sculpture of a man fishing on the top of it; he is known as The Fisher of Dreams, and is constructed of galvanised steel.

The section of line between York and Riccall, was featured on the TV series Walks Around Britain in 2017, complete with a CGI film of how the railway would have looked in the days of steam.