The lawyer's most important work is before trial even begins:

From a study done by Judge Hoffman in Denver, over a decade ago, but still important now.  He analysed data provided by State Judicial, and found public defenders generally represented clients who received on average, three to five years more incarceration than those represented by private attorneys.  The study doesn't stop there, and is worth a thorough reading to examine the issues behind the lower effectiveness rate; however, this paragraph appears and points out the following important ideas:  

IV. BAD FACTS, NOT JUST OVERWORKED LAWYERS In seeking to discover hidden forces that drive case outcomes—that is, in 95% of the cases, the forces that drive plea bargains—it is sometimes easy to overlook the obvious. Trials are about truth-finding, and plea bargaining is about lawyers, defendants and victims making predictions about truth-finding. Bad facts will tend to get defendants convicted quite apart from the skill of their lawyers, or the lack of skill of the prosecutors (assuming a minimum level of prosecutorial competence). Conversely, weak facts, coupled with the high burden of proof, will tend to result in acquittals, again quite apart from the skill of the lawyers (assuming a minimum level of defense competence). Thus, in a system that tries only 5% of all criminal cases, the most important skill for a lawyer on either side is the ability to evaluate a case before entering into plea negotiations, not the ability to shine at trial.(cit. om.)

 

From, An Empirical Study of Public Defender Effectiveness: Self-Selection by the “Marginally Indigent”* Morris B. Hoffman,** Paul H. Rubin*** & Joanna M. Shepherd**

 

Notice, only 5% of cases go to trial.

The remaining cases then are primarily resolved by plea bargain, meaning the effectiveness of pretrial investigation is of paramount importance to those cases.  The conclusion is that the most important skill of an attorney, even a very good trial attorney, is investigation prior to the trial itself.