
366 S.E.2d 712 (1988)
Michael Robert LaFLEUR
v.
COMMONWEALTH of Virginia.
Record No. 0249-87-1.
Court of Appeals of Virginia.
April 5, 1988.
Morris H. Fine (Fine, Fine, Legum & Fine, Virginia Beach, on brief), for appellant.
Linwood T. Wells, Jr., Asst. Atty. Gen. (Mary Sue Terry, Atty. Gen., Richmond, on brief), for appellee.
Present: BAKER, BARROW and HODGES, JJ.
BARROW, Judge.
In this criminal appeal we conclude that the mandatory sentence required upon a conviction for the use of a firearm during the commission of a felony prevents a trial court from sentencing a person to an indeterminate commitment to the Department of Corrections.
The accused, a nineteen year old with no prior criminal record, was convicted on a guilty plea of four counts of robbery and four counts of use of a firearm in the commission of a felony. At sentencing the trial court ruled that the mandatory provisions of Code § 18.2-53.1 prevented sentencing the accused to an indeterminate commitment to the Department of Corrections under Code § 19.2-311.
The sentencing alternatives under Code § 19.2-311 differ from those required by Code § 18.2-53.1. Under Code § 19.2-311, a trial court may commit certain youthful offenders to the Department of Corrections for a period of four years which shall be an indeterminate commitment except that it shall not exceed four years. On the other *713 hand, Code § 18.2-53.1 requires the trial court to sentence a person convicted of the offense of use of a firearm in the commission of a felony to prison for two years for a first conviction and to four years for each following conviction. Thus, a commitment under Code § 19.2-311 is contrary to the mandatory provision of Code § 18.2-53.1.
The mandatory sentence in Code § 18.2-53.1 aims to deter violent criminal conduct by imposing a mandatory penalty. "The purpose of [this statute], keyed to serious crimes and prescribing inflexible penalties, is to deter violent criminal conduct." Holloman v. Commonwealth, 221 Va. 196, 198, 269 S.E.2d 356, 358 (1980). By replacing a "wide range of discretionary penalties" with "inflexible penalties," the General Assembly intended "to deter violent criminal conduct rather than to reform the most dangerous class of criminals." Ansell v. Commonwealth, 219 Va. 759, 763, 250 S.E.2d 760, 763 (1979) (emphasis added).
This purpose would be eroded by committing an offender under Code § 19.2-311 in lieu of sentencing him under Code § 18.2-53.1. This would substitute a discretionary penalty for an inflexible one. The General Assembly has directed a contrary policy which courts must follow.
For these reasons, we conclude that the trial court did not err, and we affirm the judgments of convictions.
Affirmed.
