We study an intertemporal utility maximization problem where taxpayers can engage in both tax avoidance and tax evasion. Evasion is costless but is fined if discovered, while avoidance is costly but might be successful (i.e. deemed legitimate) with a given probability ($\beta$) upon audit. We find that traditional deterrence instruments (fine and frequency of audit) reduce optimal evasion but, in contrast with results in a static framework, they have no impact on optimal avoidance. In fact, tax avoidance depends negatively on its marginal cost and positively on both its probability of success ($\beta$) and the tax rate. We show that non-compliance behavior may result in a Laffer curve for fiscal revenues and that the revenue maximizing tax rate is lower the higher $\beta$. We characterize the optimal level of $\beta$ by taking into account different government objectives: minimizing evasion, minimizing non-compliance (evasion plus avoidance), or maximizing revenues. Our results suggest that specific policies (e.g., tax simplification) need to be implemented to deter avoidance and we illustrate their impact on evasion.