The second son of Sir James Lockhart of Lee, laird of Lee, he was admitted as an advocate in 1656. He was knighted in 1663, and was appointed Dean of the Faculty of Advocates in 1672. He was celebrated for his persuasive eloquence. In 1674, when he was disbarred for alleged disrespect to the Court of Session in advising an appeal to parliament, fifty barristers showed their sympathy for him by withdrawing from practice. Lockhart was readmitted in 1676, and became the leading advocate in political trials, in which he usually appeared for the defence. He lived on Mauchine's Close, previously the home of Sir Thomas Hope. He was a Commissioner to the Scottish Parliament for Lanarkshire in 1681/82 and 1685/86. He was appointed Lord President of the Court of Session in 1685, and a Privy Counsellor and a commissioner of the Exchequer in 1686. Lockhart purchased the extensive estates of the Earls of Carnwath in Lanarkshire, which were inherited by his eldest son, George Lockhart of Lee, whose mother was Philadelphia, daughter of Lord Wharton. Lockhart was murdered in Edinburgh returning from church on Easter Sunday, 31 March 1689, by John Chieslie of Dalry, the father ofLady Grange, and older brother to Robert Chieslie, a future Lord Provost of Edinburgh. Chiesley had been unhappily married to Margaret Nicholson, mother of their ten children. Margaret took her husband to court for aliment. She was awarded 1,700 merks by Sir George. Furious with the decision, Chiesley decided to kill Lockhart. He followed Lord Carnwath, who was accompanied by his cousins, John Lockhart and Daniel Lockhart, from St Giles Cathedral, up the Royal Mile a short distance, and down Mauchine's Close to Lockhart's house. Here Chieslie shot him in the back, just outside his house. The assailant made no attempt to escape and confessed at his trial, held before the Lord Provost, Magnus Prince, the next day. Two days later he was taken from the Tolbooth to the Mercat Cross on the High Street. His right hand was cut off here, and then nailed onto the gates of West Port. He was then taken to the gibbet at the Gallowlee where he was then hanged, and the pistol he had used for the murder was placed round his neck. Lockhart is buried in the distinctive domed mausoleum of Sir George Mackenzie on the south side of Greyfriars Kirkyard.