"And they gathered together to fight with Joshua" (Joshua 9:2). Rabbi Aibu said in the name of Rabbi Eleazar son of Rabbi Yose the Galilean: in three places the inhabitants of the world contended against the Holy One, blessed be He. One was in the generation of the Dispersion: "And the whole earth was of one language" (Genesis 11:1). And what is meant by "and of one speech" ["devarim achadim"]? They were speaking words of blasphemy against the Holy One, blessed be He [reading "achadim" as words aimed at the One]. And one was in the days of Gog and Magog: "The kings of the earth set themselves, and the rulers take counsel together, against the LORD and against His anointed" (Psalms 2:2). And one was in the days of Joshua, as it says, "And they gathered together to fight with Joshua and with Israel with one mouth ["peh echad"]." What is meant by "one mouth"? That they contended against the Holy One, blessed be He, concerning whom it is said, "Hear, O Israel, the LORD our God, the LORD is One" (Deuteronomy 6:4).
Three Times the Nations Gathered Against the Holy One
Yalkut Shimoni on Nach 19:1
ויתקבצו יחדיו להלחם עם יהושע (יהושע ט, ב) א"ר איבו בשם ר"א בנו של ר' יסי הגלילי בשלשה מקומות חלקו באי עולם על הקב"ה, אחד בדור הפלגה ויהי כל הארץ שפה אחת ומהו ודברים אחדים דברים של חירופין היו משיחין אחר הקב"ה. ואחד בימי גוג ומגוג יתיצבו מלכי ארץ ורוזנים נוסדו יחד על ה' ועל משיחו, ואחד בימי יהושע שנא' ויתקבצו יחדו להלחם עם יהושע ועם ישראל פה אחד מהו פה אחד שחלקו על הקב"ה שנאמר בו שמע ישראל ה' אלהינו ה' אחד: