During this long period his intelligence, energy, and thorough knowledge of the Oriental character enabled him to exercise an amount of influence, both with the Government and with the native of all classes with whom he came in contact, such as had never been enjoyed by any of his predecessors, and such as none of his successors is ever likely to obtain.
He belonged, in fact, to a category of diplomatists who are very useful in semi-civilized countries, but who are no longer to be found so near to Europe, and who are not well adapted to the present methods of bureaucratic and Parliamentary control.
In 1845, he acted as a mediator in the difficulties which Morocco had with Denmark, Sweden, and Spain.
In that capacity, he signed the convention which the Sultan concluded with the Court of Madrid.
In 1856 he negotiated and signed the Anglo-Moroccan Accords, a general treaty and a commercial convention with the Moroccan government.
He was raised five years afterwards to the rank of Minister Resident.
In 1861 he was appointed by Emperor Pedro II of Brazil a Knight Grand Cross of the Order of the Rose.
His further promotion to the rank of Minister Plenipotentiary took place in 1872, and to that of Envoy Extraordinary in 1880.
In July 1886, he retired on a pension, and was sworn a Privy Councillor, but he continued to reside privately a great part of the year in the country where he had served his country, so long and so successfully.
He died at Wedderburn Castle, near Duns, in Scotland.