Contact an attorney immediately. A competent attorney may provide invaluable guidance that helps prevent you from incriminating yourself, while staying within the bounds of the law. In limited cases, this advice can help prevent charges from ever being brought.
If you are picked up and held for questioning or charged with a crime, tell the police that you wish to remain silent and you do not wish to answer any questions without an attorney present. It is even more imperative that you not discuss the circumstances of the crime with police before you have seen an attorney. This, at times, may be difficult. The police can legally leave you sitting for hours in a cold room after you have refused to talk. Or they might make promises of leniency if you will only open up. It is in your best interest, however, not to start talking. The state has to prove you guilty of a crime beyond a reasonable doubt. Once you start talking, you may unwittingly remove any doubts about your guilt and severely limit the options your attorney has in defending you. And as to the promises of leniency, the police do not always have the final control over how you are charged or sentenced.