instinct kicking in: you are stroking your cat with your hand, he seems to be enjoying it thoroughly, then suddenly he bites or scratches that hand—then stops and licks the same hand he just bit. Is your cat confused? In a way, yes. A cat has to learn to let a human being stroke him, for the natural instinct would be to regard stroking as threatening.
Nature programs the cat to bite or scratch the hand, then run. So instinct goes head to head with the learned behavior of relaxing under a human touch. When a cat bites or scratches and then licks your hand, he is very suddenly doing a switch from instinct-led wildcat to taught-to-be-relaxed-while-touched house cat.