intended goal is, in general, indispensable to every voluntary act. The Prophet (may Allah bless him and grant him peace) said:
“The truest names are Hārith (one who works) and Hammām (one who resolves).”
For every human being—indeed, every animal—must have resolve, meaning will, and engage in work, meaning action, since moving by its own will is an essential characteristic of an animal. Whatever it intends is its goal, even though another intention may subsequently arise. Souls find tranquillity only when they attain their intended goal.
As for intending the act of worship, this means intending the particular deed. Someone who seeks Allah and the Hereafter through his deeds may seek Him through prayer or through Hajj. Likewise, someone who intends to obey Him by complying with His command has obeyed Him in this act. He may also intend to obey Him through this particular act. This second kind of intention is like intending prayer rather than fasting, then the noon prayer rather than the afternoon prayer, then an obligatory prayer rather than a voluntary one. This is the intention generally discussed in later works of jurisprudence. Both kinds of intention are obligatory in general.
As for the first, it distinguishes those who worship Allah, devoting their religion sincerely to Him, from those who worship false objects of worship or associate others in the worship of their Lord. It also distinguishes those who seek the harvest of the Hereafter from those who seek the harvest of this world. This is the religion devoted sincerely to Allah, which all revealed laws share and concerning which the prophets were forbidden to become divided. As Allah Most High says:
“He has ordained for you of religion what He enjoined upon Noah, and that which We have revealed to you, and what We enjoined upon Abraham and Moses