It was rebuilt in 629 but partially destroyed by an insane Egyptian caliph in the early 11th century.
There was an Egyptian caliph in the early 11th century.