Muhammad bin Ka'b said that Allah Almighty created the souls before the bodies and took a covenant from them.