The current Berber name of Melilla is Mřič or Mlilt, which means the "white one". Melilla was an ancient Berber village and a Phoenician and later Punic trade establishment under the name of Rusadir (Rusaddir for the Romans and Russadeiron (Ancient Greek: Ῥυσσάδειρον) for the Greeks). Later it became a part of the Roman province of Mauretania Tingitana. Rusaddir is mentioned by Ptolemy (IV, 1) and Pliny (V, 18) who called it "oppidum et portus", also cited by Mela (I, 33) as Rusicada, and by the Itinerarium Antonini. Rusaddir was supposed to have once been the seat of a bishop, but there is no record of any bishop of the supposed see, which is not included in the Catholic Church's list of titular sees. As centuries passed, it went through Vandal, Byzantine and Hispano-Visigothic hands. The political history is similar to that of towns in the region of the Moroccan Rif and southern Spain. Local rule passed through Amazigh, Phoenician, Punic, Roman, Umayyad, Idrisid, Almoravid, Almohad, Marinid, and then Wattasid rulers. During the Middle Ages, it was the Berber city of Mlila. It was part of the Kingdom of Fez when the Catholic Monarchs, Queen Isabella I of Castile and King Ferdinand II of Aragon requested Juan Alfonso Pérez de Guzmán, 3rd Duke of Medina Sidonia, to take the city.
In the Conquest of Melilla, the duke sent Pedro Estopiñán, who conquered the city virtually without a fight in 1497, a few years after Castile had taken control of the Nasrid Kingdom of Granada, the last remnant of Al-Andalus, in 1492. Some Spaniards envisioned continuing the southward conquest of Muslim lands, deeper into Morocco, but such conquest was not seriously attempted, with Spain's conquering energy directed elsewhere, to the newly discovered continent across the Atlantic. Instead, Melilla was immediately threatened with reconquest by the Muslims and was besieged during 1694–1696 and 1774–1775. One Spanish officer reflected, "an hour in Melilla, from the point of view of merit, was worth more than thirty years of service to Spain."
The current limits of the Spanish territory around the fortress were fixed by treaties with Morocco in 1859, 1860, 1861, and 1894. In the late 19th century, as Spanish influence expanded, Melilla became the only authorized centre of trade on the Rif coast between Tetuan and the Algerian frontier. The value of trade increased, goat skins, eggs and beeswax being the principal exports, and cotton goods, tea, sugar and candles being the chief imports.
In 1893, the Rif Berbers launched the First Melillan campaign and 25,000 Spanish soldiers had to be dispatched against them. The conflict was also known as the Margallo War, after the Governor of Melilla and Spanish General Juan García y Margallo, who was killed in the battle.
In 1908 two companies, under the protection of Bou Hmara, a chieftain then ruling the Rif region, started mining lead and iron some 20 kilometers (12.4 miles) from Melilla. A railway to the mines was begun. In October of that year the Bou Hmara's vassals revolted against him and raided the mines, which remained closed until June 1909. By July the workmen were again attacked and several of them killed. Severe fighting between the Spaniards and the tribesmen followed, in the Second Melillan campaign.
In 1910, with the Rif having submitted, the Spaniards restarted the mines and undertook harbor works at Mar Chica, but hostilities broke out again in 1911. In 1921 the Berbers under the leadership of Abd el Krim inflicted a grave defeat on the Spanish (see Battle of Annual), and were not defeated until 1926, when the Spanish Protectorate finally managed to control the area again.
The last statue of Franco in Spain
The city was used as one of his staging grounds for the July 1936 military coup d'état that started the Spanish Civil War. A statue of Francisco Franco, the putschist general assuming the control of the Army of Africa in 1936, is still prominently featured, the last statue of Franco in Spain.
On 6 November 2007, King Juan Carlos I and Queen Sofia visited the city, which caused a massive demonstration of support. The visit also sparked protests from the Moroccan government. It was the first time a Spanish monarch had visited Melilla in 80 years.
Melilla (and Ceuta) have declared the Muslim holiday of Eid al-Adha or Feast of the Sacrifice, as an official public holiday from 2010 onward. This is the first time a non-Christian religious festival has been officially celebrated in Spain since the Reconquista.