Treaty of Wad Ras

The Treaty of Wad Ras (, ) was a treaty signed between Morocco and Spain at the conclusion of the War of Tetuan on April 26, 1860 at Wad Ras, located between Tetuan and Tangier. The conditions of the treaty exacerbated Morocco's defeat in the war, with major concessions being granted to Spain. Morocco was forced to pay a 20 million "duro" (equivalent to $4 million 1861 US dollars) indemnity—far greater the balance of the Makhzen's treasury; the territories of the Spanish exclaves of Ceuta and Melilla were extended further into Moroccan territory; and Sidi Ifni became a Spanish possession.
Historical context.
From 1859 to 1860, Morocco became engaged with the War of Tetuan against Spain. Morocco had recently suffered a major defeat in the Franco-Moroccan War at the hands of the French in 1844. In 1856, the Moroccan government signed the Anglo-Moroccan Treaty, opening up the country to foreign trade while granting several rights to British subjects in Morocco and reducing the control of the Makhzen's over the Moroccan economy. 
The Spanish campaign of 1859 came in response to the skirmishes led by local tribes that took place around the Spanish enclaves. 
After the Spain's victory over Morocco at the Battle of Tetuan and its conquest of the city in 1860, the Spanish general Leopoldo O'Donnell decided to attack Tangier. The Moroccan army, led by al-Abass Bin Abderrahman, brother of Sultan Muhammad IV, attempted to challenge the attack at Wad Ras, where he suffered a massive defeat. This defeat forced Muhammad IV to sign a peace treaty with major concessions.