After losing out massively in the 19th century, Spain needed to expand its territories and wealth after several defeats against its colonies, most of them now independent
As of 1912, with the Treaty of Fez, Morocco became a French protectorate, which means the sultan abjured sovereignty. Spain gained some territories in form of Protectorate in the North African land, known as Spanish Morocco which extended over Tangiers, the Rif and Ifni. All political, economical and military power was in hands of the foreign authorities that "protect" each area. Meanwhile the Sultan retained some of his powers, but these were largely ceremonial – in reality his power had been eroded.
As soon as they arrive the troops realised it was no summer camp; the Spanish found a hard resistance from some Rif tribes as they begin to take over and occupy the territories. The next rebellion takes place in Yebela (in the capital Tetuan) and other actions were soon to follow. The Spaniards belief that the camping would be short and effective is proven wrong. The Spanish casualties increase as the rif forces continuously combat what in their eyes were nothing but invaders. It's known as the Third Rif War
The most belligerent Rif forces were barricaded in Al Hoceima, in the heart of the Rif Mountains. Manuel Fernández Silvestre was named General Commander of Melilla. In 1921 begins to move his troops towards the mountain city planning put a stop to the resistance. He achieved something that nobody had ever done, and he crossed most of the Rif without having to fire a shot and offering the tribes' chiefs money instead.
This was a good tactic considering most of the soldiers on the campaign were inexperienced, underpaid, undernourished and under armed, as well as being terribly afraid of the Rif forces. Spain was surprised at hearing the news of Silvestre's success and dared to hope that the bloodbath in Morocco would finally end.
However Silvestre didn't disarm the native tribes, and the Melilla forces were distributed over 144 small forts. Most of these places had no water, which meant having to actually go and get it mounted on mules, in some places, everyday, which also meant they were vulnerable to ambushes. The Spanish forces were too spread out.
By 1921 Silvestre hoped to make his final advance and finally take over Al Hoceima. Most of the Spanish forces were, that night, in the base camp in the Annual settlement. Only a few hundred soldiers were stationed in forts between Melilla and them.
In May a Berber tribe persuaded Silvestre to take position deeper into the Rif. A contingent of 1500 men left the settlement. They were ambushed by rif forces, suffering over 140 casualties. Abd-el Krim, who directed the Rif campaign besieged Sidi Dris, however this time the Spanish course of action was more successful, with only 10 wounded against a 100 Rif men dead. But the important thing was that it was laid bare for the natives that the Spanish were quite vulnerable. Abd el-Krim's forces grew from 3,000 to 11,000.
But Silvestre, of course, had no idea. He believed they were isolated actions. He kept moving forward and occupied Igueriben in June of the same year, thinking to defend the Annual settlement from the south. He then left for Melilla to ask for ammunition, food, money and reinforcements.
On July 17, one of the administrators of the Spanish Office of Native Affairs attacked all the Spanish lines with the support of the local tribes. Igueriben was besieged and fell only five days later. The relief columns tried to come to their aid but to no avail. The defeat demoralized the Spanish troops in Annual.
During the Igueriben siege was going on some reinforcements had arrived at Annual and some 5,000 men were stationed there. They had food for 4 days and ammunition for one but no water. It was impossible to defend it so Silvestre decided to evacuate the settlement. However in the morning of the 22nd they received a message promising reinforcements from Tetuan.
The retreat began at 11am and just as they were leaving the camp the rif forces started shooting and chaos struck. The Battle of Annual began. Amidst the confusion the officers lost control of the situation. The soldiers tried to find cover from the bullets and it turned into a disorderly escape. Those officers that abandoned their post suffered the most casualties among their troops, those that remained calm managed to get under cover with fewer losses.
Many of the surviving troops found refuge in the Mount Arruit garrison. They managed to resist for a fortnight, but the provisions were too few and the water too little. Finally the Spanish surrendered, but the besiegers failed to see the surrender conditions and it became a massacre.
Meanwhile Melilla was under great risk and was protected by reinforcements from the Peninsula. The Battle of Annual meant the complete defeat of the African campaign and also the creation of the Spanish Legion (Tercio de Extranjeros). For the rif forces it was the victory of Annual.
After the Battle of Annual and the following confrontations Abd el-Krim corners the Spanish troops, even out of Rif. From Melilla an intensive Spanish counteroffensive began, which allowed them to recover some of the lost territories, such as Dar Drius, Nador, Zeluan and Mount Arruit. Abd el-Krim proclaimed himself Sultan of Morocco, but he was not recognized by the sheikhs of the French part of Morocco. The Rif attacks on Spanish garrisons and settlements continued all throughout 1924.
France decided to intervene and places forces all along the Spanish borders. They are attacked by Rif forces and the Battle of Uarga takes place which permits the French to enter the war. They attack the Rif troops from the South with a controversial use of chemical weapons. Abd el-Krim surrenders to the French in 1926 putting an end to the Third Rif War. He is deported to Reunion Island, from where he escaped two months later. He died in Cairo in 1963.
The terrible defeat suffered by the Spanish motivated the creation of a more organized military body. The Spanish Legion was created in emulation of the French Foreign Legion. It's chiefs are Francisco Franco and Jose Millán-Astray. Its objective was never to repeat the experience of the Third Rif War