The earliest roots of the malouf can be traced to a court musician from Baghdad named Ziryab. He was expelled from the city in 830, and travelled west, stopping finally at Kairouan, the first Muslim city of great power in Africa. The city was a center for North African ("Maghebian") culture, and was the capital of the Aghlabite dynasty. Ziryab crossed the Maghreb and then entered Cordoba during a period of cultural innovation among the diverse inhabitants of the region. He became a court musician again, and used influences from the local area, the Maghreb and his native Middle East to form a distinctively Andalusian style.