The Second Melillan campaign (Spanish: Campaña or Guerra de Melilla ) was a conflict in 1909 in northern Morocco around Melilla. The fighting involved local Riffians and the Spanish Army.
 The Treaty of Peace with Morocco that followed the 1859–60 War entailed the acquisition of a new city perimeter for Melilla, bringing its area to its current 12 km2.  Following the declaration of Melilla as a free port in 1863, the population began to increase, chiefly with Sephardic Jews fleeing from Tetouan who fostered trade in and out the city. The new 1894 agreement with Morocco that followed the 1893 Margallo War between Spaniards and Riffian tribesmen increased trade with the hinterland, bringing the economic prosperity of the city to a new level.
 However, the turn of the new century saw the attempts by France (based in French Algeria) to profit from its newly acquired sphere of influence in Morocco to counter the trading prowess of Melilla by fostering trade links with the Algerian cities of Ghazaouet and Oran. Melilla began to suffer from this, to which the instability brought by revolts against Muley Abdel Aziz in the hinterland also added, although after 1905 Sultan pretender El Rogui Bou Hmara carried out a policy of defusing hostilities in the area which favoured Spain. The 1906 Algeciras Conference sanctioned direct French and Spanish intervention in Morocco. French hastened to occupy Oujda in 1907, compromising the Melillan trade with that city. The enduring instability in the Rif still threatened Melilla. After the 12 March 1908 Spanish occupation of Ras Kebdana, which caused further potential intervention in the Moulouya basin, foreign mining companies began to enter the area. A Spanish one, the Compañía Española de las Minas del Rif [es], was constituted in July 1908, directed by Clemente Fernández, Enrique Macpherson, the Count of Romanones, the Duke of Tovar [es] and Juan Antonio Güell [es], who appointed Miguel Villanueva as chairman.
 On 8 August 1908, the Riffians attacked the mines, without causing any casualties, but Muley Mohamet was apprehended and sent to Fez, where he died in prison. Amid conflict with the Riffian tribes, Bou Hmara, lacking enough Spanish support, was forced out from the area in late 1908. Without support in hostile territory, General José Marina Vega, military commander of Melilla, asked the government of Spain for reinforcements to protect the mines, but none were sent. On 9 July 1909, a new attack occurred and a number of Spanish railway workers were killed by tribesmen, prompting a retaliatory offensive ordered by Marina Vega during which several positions near Melilla were occupied.
 As a result of these deaths, Prime Minister Antonio Maura increased the Spanish garrison at Melilla from 5,000 men to 22,000 in preparation for an offensive. All the Spanish forces involved were conscripts; at this stage, Spain had neither professional troops, nor indigenous troops under arms. The Spanish army was poorly trained and equipped and lacked basic maps.[citation needed]
 The impressment in mainland Spain that followed the beginning of the conflict brought about insurrection by the popular classes (the system provided the wealthy with facilities to avoid impressment), spilling over into the Tragic Week events, that took place from late July to early August, most acrimoniously in Barcelona, where protests intertwined with outbursts of anticlerical violence, forcing the Maura government to suspend Constitutional guarantees in the whole country after 28 July.
 Spanish troops were shot at by francs-tireurs and skirmishes occurred near Melilla. General Marina decided to post six companies at Ait Aixa, under command of Colonel Álvarez Cabrera. They left Melilla at nightfall but got lost and, in the morning, found themselves in the Alfer Canyon, where they were decimated by gunfire from the heights. Colonel Cabrera and 26 men were killed, and 230 were wounded.
 On 27 July the Spanish suffered a second defeat at Wolf Ravine The day before Marina had determined to send forces to protect the Segunda Caseta and also ordered General Pintos to keep guard in the vicinity of the Mount Gurugu at the helm of a brigade of jägers. The Riffians ambushed the jägers and inflicted losses of about 600 wounded and 150 killed on the Spanish troops (although the numbers are subject to dispute), including Pintos, who perished in action.
 After this disaster, the Spanish paused their military operations. They raised troop-levels to 35,000 men and brought heavy artillery from Spain, and at the end of August launched a new attack. By January 1910 their overwhelming strength had enabled them to subdue most of the eastern tribes. The Spanish continued to expand their Melilla enclave to encompass the area from Cape Tres Forcas to the southern inlets of Mar Chica. However, this was achieved at the cost of 2,517 casualties.[citation needed]