Intention is the spring of all action. Whether conscious or not, intention gives a person the right to claim responsibility for particular actions. It is also the firm ground of will and power to bring about particular results. Everything related to humanity and to the world, both in its inception and continuance, depends upon someone's intention.
Everything first comes into the mind as an idea and, depending upon whether or not one plans to bring it into reality, may later become a reality via perseverance. If Without the initial idea is not transformed into an intention, a project cannot bear any useful fruit. Without perseverance, defined as intent sustained through determination and resolve, no project can succeed.
Intention has a decisive role with regard to good and bad deeds. Its quality can act like a cure for any disease or disadvantage, or be the hidden catastrophe that destroys all accomplishments in a single moment. Deeds that appear very small and insignificant can engender huge positive or negative consequences, based solely on the underlying intention.
All actions undertaken in the consciousness of serving God, such as praying or temporarily refraining from some permitted pleasures, increase our rewards and raise us to a higher spiritual level. Of course, the reverse is also true. We please God by performing or renouncing certain actions according to His law, and thereby attain the best stature.
And yet at other times we may do exactly the same thing and have it mean nothing to God, for we do it without the proper intention. For example, martyrdom on the battlefield is one of the highest achievements in Islam. Those who hope for it but fight only out of their own whim and desire are not considered martyrs, and so do not receive that reward. On the other hand, those who consistently and sincerely ask for martyrdom but die in their own beds are considered martyrs, for they sincerely intended to defend Islam and provide a better future for Muslims. They have the right to hope for the reward of martyrdom and Paradise.
Intention is a key that opens the door of the infinite. When used properly, it opens the door to eternal happiness, for all duties performed properly and sincerely are rewarded not according to the amount of time spent on them, but according to the degree they involve and affect one's life. If this key is not used properly, it leads to eternal misery and wretchedness.
Any soldier ready for jihad, though not actually engaged in battle, is right to hope for the same reward as those actually fighting. A sentry waiting to stand guard is just as eligible for reward as the one actually standing guard. The reward for being on guard in the way of God is as much as the reward of one who prays for months.
Thus a believer may attain Paradise after a short life, while an unbeliever who has lived just as long will attain eternal punishment and misery. Otherwise, according to external justice, people must be rewarded according to the amount of their good and bad deeds, as well as their virtues or vices. This would mean that they would stay in Paradise as long as they had lived righteously, and in Hell as long as they lived evilly. But as eternity is the ultimate end for both good and bad people, eternal happiness or punishment lies in one's intention. An intention to live faithfully and righteously forever will result in eternal happiness, just as an intention to live in denial, rejection, and corruption forever will result in eternal misfortune.
If, in their last minutes of life, conscious and devoted servants of God were given the chance to live another 1,000 years, they would lead lives of the same caliber. Based on this sincere intention, it would be accepted and rewarded accordingly, for believers' intentions are more benevolent than their deeds.  The same would be true of unbelievers, who would continue to live their evil lives if given the same choice. So, people are rewarded or punished according to their intention. The intention to acquire true faith and to preserve it results in eternal bliss; the opposite results in eternal torment.
Satan will pay most dearly for the everlasting unbelief he encourages or nurtures. Satan has undeniable effects on people, some of which are good. As a result of his activities, some people improve their innate capacities, discover and refine their hidden values and virtues, and become more alert and conscious.
Satan attacks individuals and peoples. By sowing poisonous seeds in our hearts, he seeks to trap us in vice and evil. Our spiritual faculties warn us against his temptations and corruption, and call us to battle, just as particular bodily cells raise the alarm and resist infection.
Just as resistance to disease improves the body's immunity, our spiritual state is strengthened by seeking refuge in the All-Mighty. Given this, we stand to gain much more benefit than harm from Satan's attacks. Any testing of the spirit increases its alertness, consciousness, and power to resist. All of these make the spirit even more determined to do what is right, and more prudent when it encounters danger. Such testing transforms warriors into veterans in the way of God, martyrs and saints, and distinguishes believers from unbelievers.
Yet Satan has no share in the reward of those who attain high virtue by struggling against him, for he intends to lead people astray and corrupt them out of spite and rancor. He is punished eternally for his evil intention and bad deeds:
God asked: "What prevented you from bowing down when I commanded you?" Satan replied: "I am better than he. You created me from fire, and him from clay." God said: Get out. It is not for you to be arrogant here. Get out, for you are of the meanest." He said: "Give me respite till the day they are raised up." God replied: "Be among those who have respite." Satan said: "Because you have thrown me out of the Path, I will lie in wait for them on Your Straight Path." (7:12–16)
After his jealous and arrogant disobedience, Satan willfully chose the way of rebellion and unbelief. His oath to lead people astray is the beginning of our never-ending tragedy.
In sum, intention is almost everything for believers, for it can elevate our most routine acts and produce much fruit. Its quality and content opens the door to the eternal and blissful life, as well as the door to eternal punishment and misery. As we say: "Actions are judged only by intentions, and a person will have only what was intended." 
 Bukhari, Bad' al-Wahy, 1; Muslim, Imara, 155; Abu Dawud, Talaq, 11.