Don't be involved in the incident to start with. If you had no choice, and you are at fault in the incident, admit it and face the consequences. Then, learn from it and move on. You may be able to do something to help the issue be settled out of court, or help have the most favorable outcome possible, but magic won't get you out of trouble when you mess up. Sorry.
i have a spell or two to help with a court case, but to forget, i'm not sure. personally, you made your bed, now lie in it [don't know if it's your fault or not, just saying] the way the threefold law works, you made a mistake, you need to suffer the consequences. i know that's not always the case, some vindictive person could be doing something because they don't like you, i don't know this. uma no hone as it were [Japanese idiom, basically means unknown background and/or little detail]
you could try a honey jar spell to make the person soften up and decide not to press charges. but if the unlawful act has not been committed, i'd simply not go through with it.
I'd need more information before I judged you, are you the victim or done something to another person? If your the victim then go & see your Doctor for counseling. If your the preparator then *three fold law~Harm none!* I agree with others, you've mad your bed so lie in it! You had choice to do wrong. When we do wrong we will be paid back with a karmic kick up the bottom! If your truly remorseful the Lord & Lady will see that, you need to pray. They will see into your heart & see if it's guilt talk.or true remorse. The rest it up to the Divine.
No doubt, it is possible to circumvent the law by any means especially magic. a lot of time karma sets in if you do not have a talisman to rectify it.I advise, whether you are guilty or not 'know thy self!'