Complex sentence: After the city fell, the invaders retreated due to problems in their own lands, and were replaced by the Almoravides from North Africa, who ruled until 1176.
Split into simpler sentences: After the city fell, the invaders retreated due to problems in their own lands. They were replaced by the Almoravides from North Africa, who ruled until 1176.