Or vice versa. Does it really matter what the thing is, if you do it for a different reason than many would? For example, since I'm super into Harry Potter right about now, [SPOILERS] when Snape killed Dumbledore, he appeared to have done wrong. Normally he would have had done so, but he did it to (as I recall) gain Voldemort's trust. It's been a while since I read the books, and I plan to reread them, but for now I'm left to my memory. Anyway, it can also work to the contrary: If you do the right thing for the wrong reason, I would not count that as the right thing.
What I guess I'm trying to say is, does it really matter what you do, so much as the reason for which you do it? If anyone reads this, please tell me what you think.