The following verse from Quran should answer the question:
4:79 "Whatever good, (O man!) happens to thee, is from Allah. but whatever evil happens to thee, is from thy (own) soul. and We have sent thee as a messenger to (instruct) mankind. And enough is Allah for a witness."
Comparing the above two posts by Muslaman and Watcher I conclude that Muslaman is correctly quoting islamic principle by reference to Koran. Watcher's statement is more logical but not supported and referenced.
So, Allah guides man to correct path and man is himself responsible for astray. Question remains as to why Allah does not help when man is astray? Is that his will? Can man be astrayed against the will of Allah? Is it the will of Allah for man to be astrayed at times?
If man is astrayed and Allah keeps shun, it implies there is a will of Allah for man to be astrayed since nothing can happen without the will of Allah, or can it be......?
It all goes back to Adam, Eve the devil and the test for us humans. The more we want to go on the right path the more Allah helps. After all guidance is from Allah. If one does not strive for guidance he will not get it.
As quoted in the quran:
Surah 53
39: That man can have nothing but what he strives for;
So if we dont strive for anything we wont get it. Its similar to saying that man only gets what he dreams for.