Situated 6 miles (10 km) south of Edinburgh, the town of Dalkeith lies on a ridge between the rivers North and South Esk. Created a burgh of barony (1401) and burgh of regality (1540) while under the control of the earls of Morton, Dalkeith passed to the Buccleuchs in the mid-17th century. The settlement, which grew southwestwards from its 12th-century castle, had in the 17th century one of Scotland's largest markets in its exceptionally broad High Street. In 1831 Dalkeith was linked to Edinburgh by a railway line that transported coal, minerals and agricultural produce and two decades later, in 1853, a Corn Exchange, the largest interior grain market in Scotland, was built. Other notable buildings include the 13th-century Collegiate Church of St Nicholas, the Tolbooth (1648), Watch Towers (1827 and 1829), early 19th-century iron mills and Dalkeith House (sometimes 'Palace') which replaced the castle in the late 16th century and was rebuilt in the early 18th century. George IV stayed in Dalkeith House on his visit to Scotland in 1822 and Queen Victoria spent her first night in Scotland here in 1842. The building is now leased to the University of Wisconsin and the estate forms a Country Park extending to 344 ha (850 acres). Born in Dalkeith were Archibald Campbell (9th Earl of Argyll; 1629-85), the politician Henry Dundas (1st Viscount Melville; 1742 - 1811), the artist John Kay (1742 - 1826), industrialist David Mushet (1772 - 1847), scientist Prof. Peter Tait (1831 - 1901), meteorologist Sir John Stagg (1900-75) and rock musician Fish (b.1958). During the election campaign of 1880 that resulted in the defeat of Disraeli's government, William Gladstone delivered a famous speech in Dalkeith.
The 20th-century extension of Woodburn lies on the opposite bank of the River South Esk, together with the Thornybank Industrial Estate, home to diary manufacturers Letts Filofax.