
971 P.2d 1280 (1998)
126 N.M. 490
1999-NMCA-006
Daniel Jose ALVAREZ and Leon Keesee, Plaintiffs-Appellants,
v.
STATE of New Mexico TAXATION AND REVENUE DEPARTMENT, MOTOR VEHICLE DIVISION, Defendants-Appellees.
No. 18,576.
Court of Appeals of New Mexico.
October 29, 1998.
*1281 Peter Aeneas Keys, Silver City, for Appellants.
Tom Udall, Attorney General, Gail MacQuesten, Special Assistant Attorney General, Santa Fe, for Appellees.

OPINION
ARMIJO, J.
{1} Plaintiffs appeal from the district court's order entering summary judgment against them on the grounds that their convictions for driving while intoxicated (DWI) render them ineligible for driver's licenses. This Court raised the issue of subject-matter jurisdiction sua sponte and ordered the parties to address the issue at oral argument. After considering the parties' arguments, we set aside the district court's order for lack of subject-matter jurisdiction.

I. PROCEDURAL BACKGROUND
{2} Plaintiffs were each convicted of DWI on three separate occasions. Plaintiff Alvarez's convictions are dated July 10, 1985; May 5, 1987; and June 29, 1995. Plaintiff Keesee's convictions are dated February 21, 1990; February 27, 1990; and March 21, 1994. The most recent convictions for both Plaintiffs were entered in the Silver City Municipal Court. Pursuant to NMSA 1978, Section 66-5-29 (1953), the Department revoked Plaintiff Alvarez's license on June 29, 1995, and Plaintiff Keesee's license on March 21, 1994.
{3} On January 3, 1997, Plaintiffs filed a "Complaint for Declaratory Judgment Against Administrative Agency" in the district court. In their complaint, Plaintiffs alleged that the Silver City Municipal Court sentenced them as "first offenders" for their most recent DWI convictions, and that the Department is bound by this determination. Cf. Collyer v. Taxation and Revenue Dep't, 121 N.M. 477, 913 P.2d 665 (Ct.App.1995) (noting circumstances in which the Department is bound by express terms of court judgment and plea agreement with district attorney regarding effect of DWI conviction on revocation of a driver's license); but see Medrow v. Taxation and Revenue Dep't, 1998-NMCA-173, ¶ 11, 126 N.M. 332, 968 P.2d 1195 (recognizing instance where a prior adjudication will not bind the Department in its administrative licensing procedures). Plaintiffs further argue that the Department is therefore precluded from denying their license applications for any period longer than one year on the basis of their previous DWI convictions. See § 66-5-29. Since more than one year had passed between Plaintiffs' most recent DWI convictions and the date their complaint was filed, Plaintiffs asked the district court to declare that they were entitled to have their driving privileges restored.
{4} On March 18, 1997, the New Mexico Department of Taxation and Revenue (Department) filed a motion for summary judgment on the grounds that Plaintiffs were ineligible for driver's licenses because the undisputed facts showed they had been "three times convicted" of DWI within a ten *1282 year period. See NMSA 1978, § 66-5-5(D) (1993). The Department asserted that Plaintiff Alvarez was ineligible for a driver's license for ten years following his 1995 DWI conviction. Since a different version of Section 66-5-5(D) was in effect at the time of Plaintiff Keesee's 1994 DWI conviction, the Department asserted that he was ineligible for a license for only five years. See NMSA 1978, § 66-5-5(D) (1953) After a hearing, the district court granted the Department's motion. This appeal followed.

II. JURISDICTION
{5} The Plaintiffs' complaint alleges jurisdiction and venue in the District Court of Santa Fe County under Section 12-8-8 NMSA 1978 of the New Mexico Administrative Procedures Act (NMAPA), which provides that:
A. Unless otherwise provided by law, the validity or applicability of a rule may be determined in an action for declaratory judgment in the district court of Santa Fe County, if the rule, or its threatened application, interferes with or impairs, or threatens to interfere with or impair, the interests, rights or privileges of the plaintiff. Any representative association, including but not limited to trade associations, labor unions or professional organizations, may file the action if one or more of its members could qualify as a plaintiff. The agency shall be made a party to the action. A declaratory judgment may be rendered whether or not the plaintiff has requested the agency to pass upon the validity or applicability of the rule in question.
B. The district court of Santa Fe county may enter orders after reasonable notice and hearing upon any matter not otherwise provided for in the [NMAPA], including but not limited to procedural or substantive matters of law or equity. This right may be utilized at any stage of a proceeding, and failure to utilize the right until final decision, action or order shall not be deemed a waiver thereof. If such questions are raised upon review or appeal in the court of appeals, the court of appeals may enter any orders which could have been entered by the district court.
{6} The Department admitted Plaintiffs' jurisdictional allegations in its answer. However, "[a] jurisdictional defect may not be waived and may be raised at any stage of the proceedings, even sua sponte by the appellate court." Armijo v. Save-N-Gain, 108 N.M. 281, 282, 771 P.2d 989, 990 (Ct.App.1989); see also Wilson v. Denver, 1998-NMSC-016, ¶ 8, 125 N.M. 308, 961 P.2d 153; Masterman v. Taxation and Revenue Dep't, 1998-NMCA-126, ¶ 9, 125 N.M. 705, 964 P.2d 869. For the reasons set forth below, we hold that the district court did not have jurisdiction.

III. STATUTORY BACKGROUND
{7} This appeal plays out against the backdrop of New Mexico's elaborate network of statutory provisions detailing the procedures for revoking and restoring a driver's license. For example, Section 66-5-29 provides:
A. The division shall immediately revoke the license of any driver upon receiving a record of the driver's adjudication as a delinquent for or conviction of any of the following offenses ... when the conviction or adjudication has become final:
* * *
(2) any offense rendering a person a "first offender" as defined in the Motor Vehicle Code, if that person does not attend a driver rehabilitation program pursuant to Subsection H of Section 66-8-102 NMSA 1978;
(3) any offense rendering a person a "subsequent offender" as defined in the Motor Vehicle Code[.]
See NMSA 1978 § 66-1-4.6 (1998) (defining "first offender" as "a person who for the first time ... has been adjudicated guilty of [DWI]"); NMSA 1978 § 66-1-4.16 (1991) (defining "subsequent offender" as a person "who was previously a first offender" and has been convicted of DWI). Revocation under this provision is for one year:
B. Any person whose license has been revoked under this section ... shall not be entitled to apply for or receive any new *1283 license until the expiration of one year from the date of the last application on which the revoked license was surrendered to and received by the division, if no appeal is filed, or one year from the date that the revocation is final and he has exhausted his rights to an appeal. § 66-5-29.
See also NMSA 1978, § 66-5-32 (1990) (providing that no driver's license will be revoked for more than one year, except, inter alia, pursuant to § 66-5-5). Plaintiffs rely on these provisions.
{8} In addition, Section 66-5-5 proscribes the granting of a driver's license to certain persons. Specifically, the statute provides:
The division shall not issue a driver's license under the Motor Vehicle Code to any person:
* * *
B. whose license or driving privilege has been suspended or denied, during the period of suspension or denial, or to any person whose license has been revoked, except as provided in Section 66-5-32 NMSA 1978;
* * *
D. who, within any ten year period, is three times convicted of driving a motor vehicle under the influence of intoxicating liquor or narcotic drug[.] § 66-5-5.
The prohibition against licensure under subsection D. is for ten years:
Ten years after being so convicted for the third time, the person may apply to any district court of this state for restoration of the license, and the court, upon good cause being shown, may order restoration of the license applied for; provided that the person has not been subsequently convicted of driving a motor vehicle while under the influence of intoxicating liquor or drug in the ten-year period prior to his request for restoration of his license. § 66-5-5(D).
Until July 1, 1994, this prohibition was for five years. See NMSA 1978, § 66-5-5 (1953). The Department relies on these provisions.
{9} A driver has two statutory sources of appeal under the Motor Vehicle Code (Code). First, Section 66-2-17 sets forth the procedure for administrative appeal of denial of a driver's license within the Department, followed by judicial review pursuant to the NMAPA. In addition, for the dates relevant to this appeal, NMSA 1978, Section 66-5-36 (1953) (effective until Sept. 1, 1998) provides:
Any person denied a license or whose license has been canceled, suspended or revoked by the division, except where such cancellation or revocation is mandatory under the provisions of this article, shall have the right to file a petition within thirty days thereafter for a hearing in the matter in the district court in the county wherein such person shall reside and such court is vested with jurisdiction[.]
An appeal pursuant to Section 66-5-36, however, is subject to the following restriction in Section 66-2-17(I):
I. No court of this state has jurisdiction to entertain any proceeding by any person in which the person calls into question the application to that person of any provision of the Motor Vehicle Code, except as a consequence of the appeal by that person to the district court from the action and order of the secretary or hearing officer as provided for in this section. § 66-2-17.
We hold this provision disposes of Plaintiffs' appeal. Therefore, because Plaintiffs have not pursued relief in the Department under the procedures set forth by Section 66-2-17, the district court did not have jurisdiction to hear this case.

IV. CONCLUSION
{10} Plaintiffs have never applied for, much less been denied, a driver's license after expiration of the one year revocation period they claim applies in their cases. See § 66-5-29(B); see also § 66-5-32(B) ("[A]fter the expiration of the period specified in Subsection B of Section 66-5-29 NMSA 1978 from the date on which the revoked license was surrendered to and received by the division, the person may make application for a new license as provided by law."); NMSA 1978, § 66-5-33.1 (1995) (compliance with all appropriate provisions of the Code and the payment of a fee of $25.00, plus an additional *1284 fee of $75.00 for DWI offenders, is a prerequisite to the reinstatement of any license or registration); NMSA 1978, § 66-5-9 (1995) (listing general requirements for driver's license applications, including disclosure of DWI convictions). Accordingly, they have failed to take the mandated administrative steps necessary to vest jurisdiction in the district court. See 66-2-17(H-I).
{11} Because of Plaintiffs' procedural failure, we must set aside the district court's order for lack of subject-matter jurisdiction. However, the Code's jurisdictional labyrinth should not pose an insurmountable bar to a timely judicial review of the Department's licensing decisions, and nothing in this opinion should be construed as precluding Plaintiffs from attempting to apply for, and timely protesting the denial of, a driver's license under the Code's administrative procedures. In addition, since our setting aside the district court's order makes it unnecessary to reach the merits of whether Plaintiffs remain ineligible for a license under Section 66-5-5(D), nothing in this opinion should be construed as precluding the Department from raising this issue again in a subsequent appeal.
{12} For the foregoing reasons, we set aside the district court's order for lack of subject-matter jurisdiction. Each party is to pay its own costs and attorney fees.
{13} IT IS SO ORDERED.
HARTZ, C.J. and BOSSON, J., concur.
