Under Maryland Rule 4-345(a) an illegal sentence may be corrected at any time. You file a Motion to Correct Illegal Sentence in the court where your trial or plea took place.  It is typically ruled on by the judge who heard your case or the judge who inherits your sentencing judge’s docket.  You are not guaranteed a hearing.  The court may deny the Motion without ever granting a hearing.  However, if the court denies your motion (with or without a hearing), you have a direct right of appeal with the Court of Special Appeals.  In order for a sentence to be considered “illegal” under this rule, the illegality must be in the sentence itself.  The concept is both simple and complex and there have been many, many cases on what actually qualifies as an illegal sentence.  Some examples of illegal sentences that may be corrected under this rule include: a sentence that exceeds the statutory maximum for a particular crime, a sentence in excess of a binding plea agreement, a sentence for a crime for which a defendant was not indicted, a sentence below a binding plea agreement, an illegal upward increase in sentence, or a mandatory sentence as a second time offender without serving the requisite previous period of incarceration.  Because there is a special exception carved out in the law, an illegal sentence is not subject to waiver principles and may be raised at any time.  If the court denies your Motion to Correct Illegal Sentence, you have thirty days to note your appeal with the Court of Special Appeals.  You must then file appellate briefs and oral argument will take place before the Court of Special Appeals.