By 1861 railways were at last being constructed in the thinly populated districts of South West Scotland. The Castle Douglas and Dumfries Railway had opened in 1859, connecting with the much larger Glasgow and South Western Railway at Dumfries, and the Portpatrick Railway, later to be the core of the Portpatrick and Wigtownshire Joint Railway, was being constructed with the intention of linking Portpatrick with the British main line network and encouraging a ferry service to the north of Ireland. Desiring the advantages of connection to the railway network, and fearing the loss of County Town status to Castle Douglas, local interests in Kirkcudbright promoted the Kirkcudbright Railway to connect the town with Castle Douglas. The cost of construction was estimated at £40,000; the G&SWR was content to offer support for the scheme, and agreed to subscribe £15,000 if the CD&DR would subscribe £5,000. The Kirkcudbright Railway obtained its authorising Act of Parliament on 1 August 1861. The first general meeting of the new Company did not take place until 25 October 1861. While construction was proceeding under Wylie & Peddie, the KR concluded an agreement with the G&SWR for the latter to work the line for 42½% of gross receipts after deduction of cartage costs. The construction was ready for a demonstration trip on 30 January 1864. The line opened to goods traffic on 17 February 1864 but the Board of Trade Inspecting Officer declined to authorise passenger operation until the junction with the Portpatrick Railway was improved. The BoT had introduced a rule that junctions of single line railways must be made double-line at the point of connection, and the Castle Douglas junction did not comply. The line opened to passengers on 2 March 1864 between Kirkcudbright and a quickly-constructed station at St Andrew Street, Castle Douglas, short of the junction. The planned entry to the junction at Castle Douglas was extremely sharp; and Kirkcudbright trains entering the station had to use a short length of Portpatrick Railway track; it appears that permission for this had not been properly obtained. Signalling alterations were made at the Castle Douglas junction and a low speed restriction imposed, and through passenger running commenced on 15 August 1864. Capital was £60,000 in shares with borrowing powers up to £20,000.
Timetable
The 1895 public timetable shows seven trains each way except Sundays; one each way ran Mondays and Fridays only; the journey time was 25 minutes. The entire line between Dumfries and Kirkcudbright is shown as the "Kirkcudbright Branch". A mid morning train from London St Pancras to Glasgow gave a connection at Dumfries for Castle Douglas. A note against Bridge of Dee, Tarff and Kirkcudbright stations states, "Passengers from South of Carlisle for these Stations will be conveyed by Special Train from Castle Douglas."
Absorption and closure
The G&SWR absorbed a number of small companies that it had earlier sponsored, and this included the Kirkcudbright Railway; the change was ratified by an Amalgamation Act of 5 July 1865. The absorption became effective on 1 August 1865. The shareholders received a cash settlement of face value plus 5% for their shares. Passenger traffic ceased on 3 May 1965.
Topography
The line was a little over 10 miles long. The station at Kirkcudbright was on the east side of the River Dee; it had an all-over roof. The line ran north from Kirkcudbright, crossing the river at Tongueland Bridge and keeping to the west of the ridge that forms Bar Hill. After the station at Tarff, the line turns north-easterly crossing the Dee once again at Bridge of Dee. It joined the Portpatrick Railway a little to the west of Castle Douglas station. The junction connection there originally joined the Portpatrick Railway line a short distance west of the station, by a very sharp curve. Improvements to the layout at the station took place some time before 1894, and the Kirkcudbright line then entered independently by a more gentle alignment, passing under a separate span of Dumfries Road bridge, which was widened for the purpose. The stations were:
Kirkcudbright; opened 2 March 1864; closed 3 May 1965;
Tarff for Gatehouse; opened 2 March 1864; renamed Gatehouse 1 September 1865; renamed Tarff 1 August 1871; closed 3 May 1965;
; opened 18 April 1864; closed 26 September 1949;
Castle Douglas St Andrew Street; opened 2 March 1864; closed 1 December 1867;