# Taifa of Almería

The Taifa of Almería (Arabic: طائفة المرية, Ta'ifa al-Mariyah) was a Muslim medieval Arab kingdom located in what is now the province of Almería in Spain. The taifa originated in 1012 and lasted until 1091.
In this period the city of Almería reached its historical splendour under powerful local emirs like Khayran, the first fully independent Emir of Almería and Cartagena, and Abu Yahyà Muhammad ben Ma'n. Almería declared independence of its province from Caliphate of Cordoba around 1012. It remained as an independent kingdom, although several campaigns of the Taifa of Seville diminished its territory in the north.
The kingdom was important due to its strategic location, its harbour, and a developed and very important textile industry, with around five thousand looms, being also a center of silk industry, which originated a very strong commerce with other parts of Europe and which remained until the Muslims were expelled in early 17th century. The emirs of Granada, Seville and Valencia tried to conquer the little Almería kingdom many times. However, it remained independent until the arrival of the Almoravid dynasty, except for a short period of Valencian occupation. The governor sent by the Valencian King, Ma'n, thereafter declared again the independence of Almería.
The kingdom finally was annexed to the Almoravid empire, as were all of the other taifas.

## History

The exact year that Almeria gained independence from the Caliphate of Cordoba is debated by scholars. Some historians claim that the kingdom was independent when the Slavic Governor Ibn Aflah came to power. This is debated due to the influence Cordova still had during the two years of Ibn Aflah’ rule. However there is no doubt that once Khayran, himself a former governor of Almeria under the Caliphate, returned and took the city by siege, Almeria had gained independence.
During the rule of Khayran investments were made into the infrastructure in Almeria. Khayran expanded and fortified the Alcazaba, the palace of Almeria. He also invested in expanding the great mosque of Almeria. Khayran's reign was a time of economic prosperity for Almeria. The port of Almeria started to gain importance as a way to export the luxury goods manufactured in Almeria.
Zuhayr’s ambitions would prove to be disastrous. Zuhayr allied with the Taifa of Grenada against Seville which allowed him to occupy the city of Cordoba in 1035, marking the height of Almerian expansion. However Zuhayr affronted his allies in Grenada by trying to seize complete control of the alliance. This action caused a revolt among his own troops, ultimately leading to his death in 1038. After Zuhayr’s death there was a power vacuum in Almeria which led to the occupation by the Valencian Emir, Abd al-'Azīz in 1038.
Almeria once again underwent a period of growth during the reign of the young al-Mutasim. Although the kingdom was the smallest that it had ever been under al-Mutasim, it flourished economically and culturally. Almeria’s port was the key to its success during this time. The port served has a way to export goods from Almeria, but it also grew into the main port for all of Andalusia. Al-Mutasim expanded the cultural significance of Almeria by assembling a court of many of the top muslim poets of the time. Al-Mutasim also invested in the infrastructure of the city using funds generated from the port. He constructed public water fountains near the cities mosque and expanded the Alcazaba further.

## List of kings
### Slavic rulers

* 1012 Ibn Aflah.
* 1014 Khayran Al-‘Amiri. Slavic slave from Cordoba Caliph palace, who dedicated his rule to the development of Almería.
* 1028 Zuhayr Al-‘Amiri, also a former Slavic slave from Cordoba
* 1038 Abu Bakr al-Ramimi
* 1038 Abd al-Aziz al-Mansur, al-Mansur's grandson, King of Valencia
From 1038 to 1041 Almería belonged to the Taifa of Valencia.

### Banu Sumadih family

* 1041 Ma'n ben Muhammad ben Sumadih (Tujibi)
* 1051 Abu Yahyà Muhammad ben Ma'n, al-Mutasim
* Regency period of Abu 'Utba from 1052 to 1054 or 1055
* 1091 Ahmad ben Muhammad, Mu'izz al-Dawla (only from June to October or November 1091)

## Symbols

The taifa of Almeria flag was the first flag of Andalusia known to history, and one of the first flags in Europe; it had two green transverse stripes with a white stripe between them. This flag was the precursor of the green and white flag used by several other kingdoms in southern Iberia such as the Kingdom of Granada, which had a red flag as its main one, but also had various green and white flags for different locations in the kingdom. It has been said that with the defeat of Granada, twenty flags were conquered, eighteen of which were green and white striped. The flag of the taifa of Almeria remained the flag of the Castilian troops in Andalusia, and in the 19th century was adopted as the flag of the Andalusian nationalist movement agitating for regional autonomy within Spain. This flag became the official, current flag of Andalusia after enactment of the statute of autonomy in the early 1980s.
When Abu Asbag ibn Arqam, a poet from Guadix who served as vizier of King al-Mu'tasim of Almería, saw the green and white flag on top of the Alcazaba of Almería, he wrote a poem which is regarded as the oldest written document describing a flag in Europe:
   The green flag spread over you the wing of bliss,
   It made its wišāḥ of the white morning glow;
   Its flutter makes it seem to be your foe's heart,
   Whene'er the wind is striking it full;
   It guarantees to you good luck in victory:
   Watch the good omen which forebodes success! (Note: wišāḥ is an ornamental belt)