In the 19th century, a new merchant class arose and came to wield unprecedented political influence and began to supplant hierarchies based on "sharīfī" lineage. This new commercial elite gained prestige through its value to the Makhzen through its ties with European trading companies, and their knowledge of European languages and modern governing, economic, and business models. In 1830, for example, after the French invasion of Algiers, a group of merchants from Fes convinced Sultan Abd al-Rahman not to end relations with France, as their commercial interests in Algeria were too important to be threatened by political conflict. After the Anglo-Moroccan Treaty of 1856 and later treaties with France and Spain, Moroccan merchants—Muslims and Jews alike—flourished. From the mid-19th century, Moroccan merchants joined the bureaucracy of the Makhzen, which was expanding to facilitate relations with Europe, in roles as tariff-inspectors or the "umanā'" established by Muhammad IV.