The last thing you want to get into while abroad is a legal issue. In the case that you do, here are some tips and resources.

If you are arrested while abroad the U.S. Consulate can only visit you in jail, provide you a list of local attorneys, notify your family, intercede with local officials to ensure you’re treated properly under the law and in accordance with internationally recognized standards, and protest mistreatment.
However, the U.S. Consulate CANNOT demand release, represent you at trial or provide legal council, or pay legal fees with U.S. government funds.