Why did Amalek attack Yisrael at this juncture? What had Yisrael done wrong?
Rashi: Hashem is always close to You, to help you in time of need, and you turn round and ask "ha'Yesh Hashem Bekirbeinu im Ayin?! By your life, the dog will come and bite you and you will cry out to Me. Then you will know where I am". 1
Seforno: He came because there was strife, and he took advantage of the fact that they were thirsty.
Mechilta: Because they strayed from the Torah that Moshe had taught them. 2
This can be compared to a father traveling along the road with his son on his shoulders. When the boy saw something lying on the street and his father to give it to him his father complied. This a second time and a third time. Then as a man came towards them, the son asked him whether he had seen his father. 'What, his father exclaimed angrily, you don't know where I am?' He threw him down and a dog came and bit him (Rashi).
The acronym of Refidim is 'Rafu Yadayim' (they were lax). See also Ba'al ha'Turim.