 He represented Edinburgh in the Parliament of Scotland
from 1665 to 1674.About this time Ramsay became friendly with John Maitland, 1st Duke of Lauderdale.He became a member of the Privy Council of Scotland, a judge of the Court of Exchequer, and, on 23 November 1671, by Royal appointment, a judge as a Lord Ordinary in the Court of Session as Lord Abbotshall, regardless of not being a trained lawyer (but not the only one).