Mental intention is always necessary for an action. However an intention (such as Right Intention of the Noble Eightfold Path) does not always have to have 'self' or 'attachment' involved with it.
There are three kinds of kamma: (1) bad kamma; (2) good kamma; & (3) void kamma.
The intrinsic meaning of 'good & bad kamma' is there is attachment or 'self' invested in the action & its results. To quote the scriptures:
And what is the right view with effluents (defilements), siding with merit (goodness), resulting in acquisitions (attachment)? There are
fruits & results of good & bad actions.
'Void kamma' means there is no 'self' invested in the kamma.
Buddhas appear in the world for the primary purpose to teach about void kamma or ending kamma. The higher practise of Buddhism is doing necessary & compassionate kamma with a void mind or 'doing without a doer' (rather than for the accumulation of good karma). It is for stopping obsession with kamma & stopping creating (new) sankhara. To quote the scriptures:
And what is the cessation of kamma? This noble eightfold path — right view, right resolve, right speech, right action, right livelihood,
right effort, right mindfulness, right concentration — is the path of
practice leading to the cessation of kamma.
In summary, the enlightened view is 'ignorance' is the doer of both good (meritorious) & bad (demeritorious) kamma and 'wisdom' is the doer of enlightened void selfless kamma.
Bhikkhus, if a person immersed in ignorance generates (abhisankharonti) a meritorious (good) formation (saṅkhāraṃ), consciousness fares on to the
meritorious; if he generates a demeritorious (bad) formation, consciousness fares on to the demeritorious; if he
generates an imperturbable formation, consciousness fares
on to the imperturbable. But when a bhikkhu has abandoned ignorance
and aroused true knowledge, then, with the fading away of ignorance
and the arising of true knowledge, he does not generate a meritorious
(good) formation or a demeritorious (bad)
formation or an imperturbable formation. Since he does not
generate or fashion formations, he does not cling to
anything in the world. Not clinging, he is not agitated. Not being
agitated, he personally attains Nibbāna. He understands: ‘Destroyed is
birth, the holy life has been lived, what had to be done has been
done, there is no more for this state of being.’
This link may be helpful: Kamma in Buddhism