The action, if it is sincere and not correct then it is not accepted.
It is only accepted when it is both sincere and correct.
Fudayl ibn Iyad
Similar to Imam Ghazali's quote about intentions, that the action must be correct other wise it is rejected. The same is echoed by Fudayl ibn Iyad.