After his marriage to Oliver Cromwell's niece in 1654, Lockhart was appointed to a number of diplomatic and political posts under the Commonwealth. These included Commissioner for Justice in Scotland and Ambassador to France, 1656 to 1660. In this role, he helped negotiate the 1657 Treaty of Paris, an Anglo-French alliance against Spain. He also commanded English troops at the 1658 Battle of the Dunes, later serving as Governor of Dunkirk.