He joined the Royal Navy in 1772, at the age of seven, and first saw service at the Battle of Sullivan's Island in 1776 aboard, which ran ashore and was destroyed to keep her from being captured. He was transferred to and was present at the capture of New York City, and then transferred into where he assisted in the capture of the. In 1780, at the age of 15, he was appointed Lieutenant, and appointed to the captured frigate. He later served aboard at the relief of Gibraltar.
He was wounded at the Glorious First of June in 1794, where he was the second lieutenant of the third-rate. He was then assigned to the West Indies, commanding the cutter ; he led the ship against a much more powerful French privateer, and was promoted to take command of the brig as reward. He advised the local commander, Admiral Henry Harvey, that Trinidad was ripe for capture, and helped lead the fleet which captured the island in 1797. During his service in the Caribbean he captured a privateer whilst protecting a convoy to St. Kitts, and led a force which captured the fortifications on Margarita Island in December 1798. He then led a boarding attack on a privateer in the harbour, and whilst his force captured the ship, he himself was severely wounded in the head. He was promoted to post-captain, and rewarded with a sword from Thomas Picton, the Governor of Trinidad.
Napoleonic Wars
In 1804, commanding, he led a force which captured the West African island of Gorée, and then commanded a squadron blockading St. Malo. In the summer of 1809 he served on the panel of judges at the Court-martial of James, Lord Gambier which assessed whether Admiral Lord Gambier had failed to support Captain Lord Cochrane at the Battle of Basque Roads in April 1809. Gambier was controversially cleared of all charges. In 1809 he was ordered with Inconstant to the Isle de France, but she grounded north of the Cape of Good Hope. His solution to this problem – repeatedly heaving the keel out and righting her when the tide came in – was admired by Admiral Bertie as an excellent feat of seamanship. By 1811 he was in command of, fighting at the defence of Cadiz, and led a force at the siege of Tariffa, for which he received the thanks of the Admiralty. On 27 August 1812 he was transferred to command, which had had a succession of temporary commanders since her former commander Temple Hardy had been taken ill in May. He commanded her during a blockade of the port of Toulon. He was transferred to command HMS Rivoli on 22 February 1814, which saw extensive service in the period after Napoleon's escape from Elba. Whilst blockading Naples, he attempted to capture two ships-of-the-line by boarding them in the harbour, and later intercepted and captured the, which was attempting to bring Napoleon's mother and sister to France. This action, on 30 April, was the first French ship to surrender during the Hundred Days. He later was assigned to command the expedition against Portoferraio, and the final capture of Elba, giving him the distinction of striking the first and the last French tricolours of the Hundred Days.