Dirty Harry/Headscratchers

Okay, at the end of the first movie, Harry gets rid of his badge and is clearly not a cop anymore. However, in the sequel, he is still a cop working in the force, as though nothing had ever happened. Would someone like to explain that?
 * Magnum Force opens with Harry on loan to Stakeout, so maybe he was demoted as a result of his actions during the first film. Or for losing his badge.