Originally the Edinburgh and Dalkeith Railway, the first railway line to be built in Edinburgh, the Innocent Railway got its name because of its excellent safety record; despite carrying up to 400,000 passengers per year, no-one was ever killed. It is possible that the name also came about because of the slow pace of travel. Built in 1831, the traction was still provided by horses when the line was sold to the North British Railway in 1845. The line was planned by engineer Robert Stevenson (1772 - 1850) and built by James Jardine (1776 - 1858) for a group of investors led by Walter, 5th Duke of Buccleuch (1806 - 84). There were no stations other than the termini, and passengers simply alighted wherever they chose.
Running from St. Leonards Station and Goods Yards, trains were winched down a long inclined plane through St. Leonard's Tunnel before proceeding onwards to Duddingston, Craigmillar, Niddrie, Newcraighall and out to Dalkeith. With an extension from Niddrie to Leith, which opened in 1838, the line now linked the Midlothian coalfield, with the City of Edinburgh and the Port of Leith. The line was bought by the North British company for £113,000 and was upgraded from 4 feet 6 inches to standard gauge (4 feet 8½ inches), eventually becoming part of their 'Waverley Line'.
While sections of the line still operate today, forming a link to Leith and as part of the Southern Suburban Railway, most of the line closed in 1968. The Craigmillar - St. Leonards section was converted into a walking and cycle route in 1981 by Lothian Regional Council. With the exception of a few buildings, the St. Leonard's Goods Yard has now disappeared under housing developments constructed through the 1980s and 90s.