When a defendant is held to answer on a charge constituting a misdemeanor or infraction, for which a person injured by the act constituting the offense has a remedy by a civil action, the offense may be compromised as provided in section 29-01-17, except:
1. If the offense was committed by or upon a judge of any court in this state, or in any city in this state, or a peace officer, while in the execution of the duties of the person's office;2. If the offense was committed with an intent to commit a felony; or3. If the offense involves a crime of domestic violence as defined in section 14-07.1-01 or is a violation of section 12.1-20-05, 12.1-20-07, 12.1-20-12.1, or 12.1-20-12.2.