Murray's grandfather had been exiled to Barbados from his home in Elginshire, Scotland, following the Jacobite Rising of 1715, and his father was born there, before moving to Chestertown, Maryland, to practice as a physician, marry, and have several children, of whom Alexander was the youngest.
There being no posts available, Murray declined the offer of a letter of marque, and instead gained a commission as a lieutenant in the 1st Maryland Regiment under the command of Colonel William Smallwood.
[4] While serving at New York he suffered severe hearing loss from a bursting cannon while firing at a British fleet making its way up the North River (the lower Hudson along the west side of Manhattan).
[11] He was then appointed First Lieutenant of the frigate Alliance under the command of John Barry, sailing on her final cruise across the Atlantic, to France, and then to the West Indies, before the war's end in early 1783.
In 1794 the government, in response to attacks on American merchant shipping, passed the Naval Act, which authorised the building of six new frigates, and established the United States Navy.
[14] Murray received a commission as one of the first thirteen post-captains in the new Navy,[15] and in August 1798 was assigned to command the corvette Montezuma, with orders to protect American shipping in the Caribbean from French privateers.
Eventually a favourable breeze sprang up, and Murray was able to counter-attack with such effect, that the Tripolitan vessels fled back to the safety of the harbour under the protection of shore batteries.
[24] From July 1805 until late 1806, Murray commanded the frigate Adams, cruising along the eastern coast of the United States from New York to Florida protecting American commerce.
[27] Finally, in 1815, Murray was appointed Commandant of the Philadelphia Navy Yard, where he worked closely with chief shipwright Samuel Humphreys,[28] and remained there until his death on October 6, 1821.