Girvan and Portpatrick Junction Railway (G&PJR) was a railway company in Scotland. It opened in 1877 between Girvan and Challoch Junction, where it joined the Portpatrick Railway, which had already reached Stranraer from Castle Douglas. Portpatrick had been an important ferry terminal for traffic to and from the north of Ireland, but its significance was waning and Stranraer assumed greater importance. The new line formed part of a route between Glasgow, Ayr and Stranraer.
Running through difficult and sparsely populated terrain, the G&PJR was never financially successful, and on two occasions it had to suspend operations to due unpaid debts to adjacent railway companies. In 1887 the Company sold its concern at a huge loss to the Ayrshire and Wigtownshire Railway Company (A&WR), formed specially for the purpose. The A&WR hardly performed better, and in turn it sold its business to the Glasgow and South Western Railway (G&SWR) in 1892.
The line remains in operation at the present day, forming part of the Glasgow to Stranraer route.
The little harbour at Portpatrick was the starting point for the short sea route from Scotland to the north of Ireland as early as 1620, connecting with Donaghadee in County Down, on the east side of Belfast Lough. Cattle and horses were an important traffic, raised in Ireland and brought into Scotland for butchery, and later Post Office mails became significant: by 1838 8,000 to 10,000 letters passed through the port daily, brought by road coach from Dumfries, and from Glasgow. A barracks was erected in the town to facilitate troop movements between Britain and Ireland. However the limitations of the little harbour became serious disadvantages as other more efficient rail-connected routes, via Liverpool, and later Holyhead became dominant.
While English destinations via Dumfries and Carlisle were dominant, Glasgow and Central Scotland were obviously significant, and when the Glasgow, Paisley, Kilmarnock and Ayr Railway (GPK&AR) reached Ayr in 1840 it was natural to consider whether an extension to Portpatrick, 60 miles (96 km) away, was feasible. In 1843 a Glasgow and Belfast Union Railway was proposed to achieve the connection, but the plan foundered.
By 1853 the GPK&AR had amalgamated with others to form the Glasgow and South Western Railway (G&SWR), which encouraged the promotion of the Ayr and Maybole Junction Railway which got its authorising Act of Parliament on 10 July 1854 and opened on 13 October 1856. The line was worked by the G&SWR.