Rabbi Chaim Vital in his book "Etz HaDaat Tov" explains the verse (Psalms 124:1,2): "Had it not been the LORD who was on our side! Say so, Israel “Had it not been the LORD who was on our side when men rose up against us" and states the following:
We live under two threats. The first threat comes from all the nations of the world, and about it, it says: "If not for G-d, that He was with us, Say so, Israel!". The second danger comes from Ishmael, David prayed about it separately and said: "If not for G-d, that He was with us when Adam rose up against us."
There are four exiles and at the end of days, the Jews will be in the exile of Ishmael, who was named pere adam because of the fact that he circumcised his flesh, but did not do priya (meaning that it is an incomplete circumcision, whereas Jewish infants go through circumcision plus a separation of the skin, this second step is impossible to do at the age when Arabs normally do circumcision because by then the skin has fused and separation is not possible.)
These four exiles are compared to animals of wich the Jews will say: "If it was not G-d, who was with us..”
However the fifth exile, that of under Ishmael, is the hardest because he has the merit of the Fathers and the merit of circumcision (albeit imperfect). He is called Adam and his kingdom is stronger than other realms. And Jews will be afraid and G-d will hear their cry. Then He will reign over the Jews and the whole world. Thus the last verse of the psalm: "Help with the name of G-d Who makes heaven and earth" – also speaks about the exile of Ishmael in the sense that there’s no hope except for G-d to save us. After all, He created heaven and earth so that the Jewish people could observe the Torah. And if so, then, of course, He will save us in order that heavens and the earth will continue existing. There is no other salvation, except for the Torah which makes possible the existence of heaven and earth.