The railway through Lochmaben opened on September 1, 1863, as the Dumfries, Lochmaben, and Lockerby Junction Railway. This was operated by the Caledonian Railway, as an important link through to Stranraer and Portpatrick, and then amalgamated with them in 1865.
was the largest intermediate station on the line. It had a station master’s house/station building, 2 platforms, level crossing, goods shed and yard and a passing loop with 2 signal cabins. Goods traffic for the station included coal for the gas works in Mill Road and for domestic use, livestock for markets in Lockerbie, Dumfries and beyond, and general goods and parcels for Lochmaben and the surrounding area. The goods yard had a cattle pen, loading platforms and a hand crane for heavier freight.
In 1878-1880 the two small signal cabins were replaced by a larger single signal box of standard Caledonian Railway design with the line to Lockerbie being used to test a new form of Tyers single line control from 1878. In the 1880s a bridge carrying the B7020 was built over the railway to remove the level crossing. There was a staff of 9 at the station in 1917. By 1922 there were 5 local passenger trains per day in each direction.
In 1923 the Caledonian Railway was absorbed into the much larger London, Midland & Scottish Railway, and all express trains were routed via Annan. Economies were also made as road transport started to take traffic away from the railway. The signal box was closed in 1931-2, and the passing loop removed by the 1950s, the goods yard being controlled by a lever frame, locked with a “key” from Lockerbie or Sheildhill. The passenger trains were push-pull sets, with a tank engine, and driver’s cabin
in the last coach, which enabled the train to run without running the locomotive around the train at each end of the line.
During WW2 three elderly LNWR tank engines were sent to work the line. Traffic on the line during the war increased due to the presence of nearby military camps e.g. Halleaths, and RAF Tynwald Downs, north of Dumfries, adjacent to the line.
After the war, traffic declined further and only 4 trains ran each way. In January 1948 the railway was nationalized as part of British Railways. On July 18,1952, the last passenger train called at Lochmaben, and the station closed for passengers. Goods traffic to Lochmaben continued until 1963, and, during the late 1950s and early 1960s, a camping coach was parked on the goods siding nearest the bridge.
Special Rail tours continued to travel along the line, with the last featuring the Flying Scotsman in 1965. With the closure of the Dumfries to Stranraer “Paddy” Line in 1965, freight from Dumfries to Lockerbie and north decreased, and the line was shut completely in April 1966. The railway was lifted shortly afterwards, and the line passed into history. The station house and goods shed were demolished, the bridge and its approaches were bulldozed over the station site and filling in the Grummel Loch allowed the B7020 to be straightened through the site.