Appellant entered into a plea agreement in which he pleaded no contest to one felony in each of three drug cases in exchange for an aggregate sentence of either six years of six years eight months. The length of the aggregate term was to be determined by the trial court at the time of sentencing. The trial court chose the longer sentence pursuant to Penal Code section 1170.1. On appeal, he contended that the trial court failed to exercise its sentencing discretion because the court erroneously determined that the longer aggregate sentence was required under section 1170.1. The appellate court agreed and reversed and remanded for the trial court to exercise its discretion. Section 1170.1 provides that for multiple convictions, the aggregate term shall be the sum of the principal term, subordinate term, and any additional term. The principal term is the greatest term imposed by the court for any of the offenses. The court is not required to designate the principal term as the longest potential term of imprisonment for one of the convictions, but the longest term of imprisonment actually imposed by the court. Here, both sentences could have been lawfully structured under section 1170.1, depending on which conviction provided the term of imprisonment designated the principal term. Therefore, the trial court was not required to impose the longer sentence based on the longest potential term of imprisonment available for the crimes charged. Remand was therefore required to allow the trial court to exercise its discretion.