Each rehearing under this code shall take place before a court-martial composed of members not members of the court-martial which first heard the case. Upon a rehearing the accused may not be tried for any offense of which he or she was found not guilty by the first court-martial, and no sentence in excess of or more severe than the original sentence may be approved, unless the sentence is based upon a finding of guilty of an offense not considered upon the merits in the original proceedings, or unless the sentence prescribed for the offense is mandatory. If the sentence approved after the first court-martial was in accordance with a pretrial agreement and the accused at the rehearing changes a plea with respect to the charges or specifications upon which the pretrial agreement was based, or otherwise does not comply with the pretrial agreement, the approved sentence as to those charges or specifications may include any punishment not in excess of that lawfully adjudged at the first court-martial.
Ala. Code § 31-2A-63 (1975)