In 1737, Murray acted as Counsel for the City of Edinburgh in the aftermath of the death of Captain John Porteous. In Edinburgh, it was traditional for criminals sentenced to death to be allowed to visit a church near the city jail the Sunday before the execution. Two criminals named Wilson and Robertson took this as an opportunity to escape, and although Wilson did not make it out of the church, Robertson escaped completely. Wilson had been a smuggler who supplied his fellow citizens with goods, and because of this and the unpopularity of the city guard, public opinion was firmly on his side. Porteous was the captain of the Edinburgh city guard, and angry with Wilson's attempt to escape and aware of the possibility of an attempt to free him. Porteous ordered a guard of 80 men to be placed around the gallows for Wilson's execution. When a man attempted to cut Wilson's body down after the execution, Porteous ordered his troops to fire on the crowd, and seven people were killed. Porteous was initially sentenced to death for murder, and when the execution was delayed, a mob of citizens rushed the city jail and lynched him.