His first service was under Lord Cochrane (afterwards tenth earl of Dundonald) in the famous "Imperieuse," and no midshipman ever had a livelier apprenticeship to the sea.
During his two and a half years of service under Cochrane, the young midshipman witnessed more than fifty engagements, and had much experience of service on the coast of Spain in the early stage of the Peninsular War, in the attack on the French squadron in the Roads (April 1809) and in the Walcheren expedition.
A Brazilian squadron, under command of Lord Cochrane, attacked the Portuguese vessels, embarrassed with troops, and took several of them.
Its anchorage was used by Lord Cochrane in 1820 during his attacks on Callao; it was the landing-place of an invading Chilean army in 1838; it was bombarded by the Chileans in 1880; and in 1883 it was the meeting-place of the Chilean and Peruvian commissioners who drew up the treaty of Ancon, which ended the war between Chile and Peru.
A fleet of armed ships was fitted out at Valparaiso in Chile, under the command of Lord Cochrane (afterwards earl of Dundonald) and officered by Englishmen.