There are a lot of factors to be considered when entering a plea in a criminal case. Every case is different but here I will discuss some of the factors that will be considered when a plea is offered, negotiated and accepted or rejected. The state should begin by making an offer that fits within the law. Your attorney is there to make sure that the offer does not fall outside of what the law allows. For instance, if you are accused of stealing a pack of gum the state cannot legally make an offer of 20 years in prison. Each crime carries with it a classification (e.g. Class A felony) and a range of sentence. That range of sentence may be enhanced by other factors contained within the code such as the use of a firearm in the crime or commission of a crime in close proximity to a school. Alabama also has a Habitual Offender Statute that will likewise enhance punishment if you have previously been convicted of a crime. The state also has Sentencing Guidelines that are frequently used to determine an appropriate sentence. The Sentencing Guidelines are worksheets that can be filled out. A numerical score is given based on your criminal history and if that number reaches a certain threshold prison time may be recommended. The nature of the crime - whether it was violent or not - will also be a factor. Your conduct in jail or while on bond will also affect the offer of the state. For instance, if you decide to leave the state and have to be extradited that will affect the states offer. Internal policies in the District Attorney's office may be a factor as well. The temperament of the Judge may require consideration as well. All this to say that you need to have a lawyer that is well versed in the law and the process to be sure that you are making the right plea deal.