In our framed laboratory experiment, two Public Officials, A and B, make consecutive decisions regarding embezzlement from separate funds. Official B observes Official A's decision before making their own. There are four treatments: three with deterrence and one without. We find a peer effect in embezzlement in that facing an honest Official A reduces embezzlement by Official B. Likewise, deterrence matters in that higher detection probabilities significantly decrease embezzlement. Crucially, detection is more effective in curbing embezzlement when chosen by an honest Official A compared to a corrupt Official A at almost all individual detection levels. This 'legitimacy' effect may help explain why anti-corruption policies can fail in countries where the government itself is believed to be corrupt.