Praise be to Allah, the Lord of the Worlds; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
Allah says: " Those who have been expelled from their homes unjustly only because they said: "Our Lord is Allah." - For had it not been that Allah checks one set of people by means of another, monasteries, churches, synagogues, and mosques, wherein the Name of Allah is mentioned much would surely have been pulled down. Verily, Allah will help those who help His (Cause). Truly, Allah is All-Strong, All-Mighty. (Al-Hajj 22:40)
This verse indicates that Jihad (fighting in the path of Allah) is a matter that existed among the previous nations. Jihad is ordained on every nation in order to protect its religion. Al Qurtubi said when interpreting the above verse: "were it not for war and Jihad, the truth would have been defeated in every nation; whoever among the Christians or the Sabians (a past nation that used to live in Mosul (Iraq) and say 'La Ilaha Illa Allah' (none has the right to be worshipped but Allah) and used to read Al- Zabur (the psalms of the Sabians) and they were neither Jews nor Christians), denies the existence of Jihad contradicts his own doctrine.
Because except for jihad, the religion would not have remained until today….."If it was not for this defense, the synagogues at the time of Moses, and the churches and monasteries at the time of the Jesus, and the mosques at the time of Mohammad would have been destroyed."
And the saying of Allah" wherein the Name of Allah is mentioned much", either this refers to the mosques, and this is what Al Qurtubi reported from Al Nahhas who said: because the pronoun is mentioned after the word "Mosques". However, Al-Qurtubi said the pronoun could also refer to churches and others, on the basis that this was at the time when their legislation was the right one and at the time when they used to follow and abide by the truth.
Allah knows best.