The 1860 Treaty of Wad Ras brought the war to an end. By terms of the treaty, Morocco was to pay Spain a war indemnity of 20 million duro (equivalent to $4 million 1861 US dollars)—far greater the balance of the Makhzen's treasury.: 25 To help pay the indemnity, Morocco took a loan from private investors in Britain. The loan, issued by Sirs Robinson, Fleming and Philippe P. Blyth, amounted to £501,200, of which the Sultan actually received £426,000. The British loan was to be repaid from half of the tariff revenue collected at Moroccan ports, to be overseen by European agents.: 25  The other half of the tariff revenue at Moroccan ports went toward the amount owed directly to Spain. The 5% interest rate was to be paid in London to the London and County Bank. The amortization of the loan was biannual.
The annual repayment of the loan represented 12% of Morocco's customs revenues, and it was repaid regularly up until 1882, when the loan was repaid in full. At this time, the British civil servants appointed by the British government to watch over the customs collection in Moroccan ports left the country.