"All who were lagging behind you" (Deuteronomy 25:18). Rabbi Judah, Rabbi Nehemiah, and the Rabbis <differ>. Rabbi Judah says: Whoever was overcome was rescued. And Rabbi Nehemiah says: Everyone whom the cloud cast out was rescued. And the Rabbis say: It was the tribe of Dan that the cloud cast out, because they were all worshippers of idolatry.
Who Amalek Struck Among the Stragglers Behind Israel
Midrash Tanchuma Buber, Ki Teitzei 15:1
כל הנחשלים אחריך. ר' יהודה ור' נחמיה ורבנין, ר' יהודה אומר מי שהיה נצוח היה ניצול, ור' נחמיה אומר כל מי שהיה הענן פולטו, היה ניצול, ורבנן אמרין שבטו של דן שפלטו הענן, שהיו כולם עובדי ע"ז.