The effect of deeds depend upon the intention
Abdullah ibn Mubaarak 171 AH (may Allah have mercy on him) said, رب عمل صغير تعظمه النية و رب عمل كبير تصغره النية “Perhaps a small deed becomes great because of the intention behind it, and perhaps a big deed becomes insignificant because of the intention behind it.” Taken from Jaami’ ‘Uloom p. 16