The use of measures other than prosecution or a criminal conviction for an act that nonetheless remains against the law. Diversion can take place before a charge is formally laid, for example if the accused person agrees to undergo treatment. It can also occur at the time of sentencing, when community service or treatment may be imposed rather than incarceration.