Those before them had already plotted, but Allāh came at [i.e., uprooted] their building from the foundations, so the roof fell upon them from above them,1 and the punishment came to them from where they did not perceive.
Translation: Saheeh International (English)
1 i.e., Allāh caused their plan to fail and exposed their plot.
The disbelievers before these people devised plots against their Messengers. Allah then destroyed their buildings from the foundations and as a result their roofs fell on them from above. The punishment came to them from where they did not expect as they had expected their buildings to protect them but they were destroyed by them.