The truth is that you should contact an attorney as soon as you suspect you are even under investigation for a criminal offense. Many people presume that they can simply cooperate with police officers and try to say the right things, but you need to understand that police can use what you say against you, and a criminal defense lawyer will know how to make sure that does not happen.
Remember that the Fourth Amendment guarantees you the right to be free from unreasonable searches and seizures. In other words, police officers will need warrants to search your property.
Be especially cautious when police officers ask you to sign anything, as what you are signing could be an authorization you are unaware of. The most obvious time to contact an attorney is when you are actually under arrest, and the police should read you your Miranda rights in these cases, which plainly state that you have the right to an attorney.
Even when you are suspected of a criminal offense, contacting an attorney can be beneficial because the lawyer will be able to arrange to have arrests performed in the way that most minimizes embarrassment for you. The attorney can also be present during the questioning to help you prevent any possible self-incrimination.