The following year, after the signing of the Treaty of Fez, the northern Moroccan area was adjudicated to Spain as a protectorate. The Riffian populations strongly resisted the Spanish, unleashing a conflict that would last for several years. In 1921, the Spanish troops suffered the catastrophic Disaster of Annual in addition to a rebellion led by Rifian leader Abd el-Krim. As a result, the Spanish retreated to a few fortified positions while Abd el-Krim ultimately created an entire independent state: the Republic of the Rif. The development of the conflict and its end coincided with the dictatorship of Primo de Rivera, who took on command of the campaign from 1924 to 1927. In addition, and after the Battle of Uarga in 1925, the French intervened in the conflict and established a joint collaboration with Spain that culminated in the Alhucemas landing which proved a turning point. By 1926 the area had been pacified; Abd-el-Krim surrendered in 1926; and the Spanish regained the previously lost territory.