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[citation needed] and Cartagena, and Abu Yahyà Muhammad ben Ma'n.
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.
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.
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.
[2] Al-Mutasim expanded the cultural significance of Almeria by assembling a court of many of the top muslim poets of the time.
When Abu Asbag ibn Arqam, a poet from Guadix who served as vizier of King al-Mu'tasim of Almería,[5] 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:[6] 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!