It is extremely important that you bring your immigration status to the attention of any criminal defense attorney you may retain. It would be advisible for him to consult with an immigration attorney prior to accepting any plea offer to see if that will subsequently affect your immigration status.
If you currently maintain permanent residency it is important to know that if you are charged with a crime and receive an adjudication, withhold of adjudication, or a pre-trial diversion sentence that results in a dismissal of the charges it will still be viewed as a conviction in the eyes of the USCIS.In addition, the length of your residency will also have a factor. If you have had permanent residency less than five years you may be subject to more stringent restrictions than those who had the residency longer than five years in terms of eligibility for relief. It can be quite confusing as an alien may not be removable for certain criminal offenses, but if they leave the US and attempt re-entry they can be deemed inadmissible.