
651 N.W.2d 635 (2002)
2002 ND 147
James J. ABEL, Plaintiff and Appellant,
v.
Earl ALLEN, d/b/a Oak Park Leasing, Defendant and Appellee.
No. 20020069.
Supreme Court of North Dakota.
August 29, 2002.
*636 Michael Ward, Eaton, Van de Streek & Ward, Heritage Place, Minot, ND, for plaintiff and appellant.
Moody M. Farhart, Farhart Law Firm, Minot, ND, for defendant and appellee.
SANDSTROM, Justice.
[¶ 1] James Abel appealed a judgment dismissing his complaint against Earl Allen, doing business as Oak Park Leasing. We conclude Abel's claim is barred by the statute of limitations, and we affirm.

I
[¶ 2] Abel and another person leased a building from Allen on April 27, 1989, for a period of five years, beginning June 1, 1989, and ending May 31, 1994. The lease gave Abel an option to purchase the premises:
Lessor, First Party, does hereby grant Second Parties, Lessees, an option to purchase the premises for $60,000.00, plus an exact amount for improvements made hereafter by First Party, Lessor; however, there shall be no additional cost to Lessees, Second Parties, for their improvements made and paid by them personally. Said option to purchase shall expire June 1, 1994.
After the lease expired, Abel continued to occupy the premises on a month-to-month basis.
[¶ 3] On May 26, 2000, Abel sued Allen for specific performance of the purchase option, or for damages for unjust enrichment. Abel alleged, among other things, he had made repairs and improvements to the property, and also alleged:
VI.
That by May 1989 he elected to exercise the option to purchase for $60,000.00, *637 plus the exact amount for improvements required under the lease. That Earl Allen knew he had the money available, but refused to sign the agreement or discuss the actual terms.... Abel understood that Earl was preparing the documents and Earl advised him that since he was a lawyer he could save them the cost of the documents, and that he would do them for nominal costs.
VII.
Once June 1, 1989 passed Earl advised [Abel] that since the date had passed he could no longer purchase the building, and the land, and he was not going to go through with it. It was understood that they would make an agreement for repayment that would be equitable as to the amount of money into the building.... Earl has often indicated that he might do so, but thus far has refused to make any sort of a fair reimbursement for his expenditures or to go through with the agreement.
[¶ 4] Allen moved for summary judgment of dismissal. On the specific performance claim, Allen contended Abel's claim accrued in May 1989, when Abel alleged he exercised the purchase option, and argued:
This action was commenced on or about May 26, 2000. The ten-year limitations period, however, had already run out the previous year, ten years after Abel avers he and Brandt exercised the option. Thus, as a matter of law, the ten-year limitations period has lapsed and the claim for specific performance must be dismissed.
Allen also argued Abel's unjust enrichment claim was barred under N.D.C.C. § 28-01-22 "[b]ecause Abel sat on his rights for 11 years before asserting his claim for unjust enrichment."
[¶ 5] In opposing Allen's motion for summary judgment, Abel submitted an affidavit stating, in part:
4. Demands were made of him to honor the option continually through the period of the lease and even after the lease was foreclosed on. Certainly a number of demands were made in the last year of the lease.
....
8. That James had requested of Earl, that Earl honor this contract and that Earl uphold his option even on the last day of the lease, and at this time Earl refused to do so at this time.
[¶ 6] The trial court granted Allen's motion for summary judgment, explaining:
The date of accrual of the time in which the plaintiff was to elect to exercise the option was May 1989. N.D.C.C. 28-01-16(2) allows the plaintiff 10 years to commence an action. The Summons and Complaint in this case were served on May 26, 2000 or 11 years after the date of accrual. Thus, the plaintiff is precluded from proceeding on the option.
A judgment of dismissal with prejudice was entered, and Abel appealed.
[¶ 7] The trial court had jurisdiction under N.D. Const. art. VI, § 8, and N.D.C.C. § 27-05-06. The appeal was timely under N.D.R.App.P. 4(a). This Court has jurisdiction under N.D. Const. art. VI, §§ 2 and 6, and N.D.C.C. § 28-27-01.

II
[¶ 8] Summary judgment is a procedural device for disposing of a controversy without a trial if either party is entitled to judgment as a matter of law, if no dispute exists as to either the material facts or the inferences to be drawn from undisputed facts, or if resolving disputed *638 facts would not alter the result. Jaskoviak v. Gruver, 2002 ND 1, ¶ 11, 638 N.W.2d 1. On appeal from a summary judgment, " `we review the evidence in the light most favorable to the party opposing the motion, and we give that party the benefit of all favorable inferences which reasonably can be drawn from the evidence.' " Id. (quoting Dahlberg v. Lutheran Soc. Servs., 2001 ND 73, ¶ 11, 625 N.W.2d 241).
[¶ 9] The parties agree the applicable statute of limitations is N.D.C.C. § 28-01-15(2), providing that suit must be "commenced within ten years after the claim for relief has accrued." Allen argued, and the trial court agreed, that the statute of limitations began to run in May of 1989, when Abel asserted he attempted to exercise his purchase option. Abel argues "the option was part of the lease," he "had a right to attempt to exercise it as long as the lease was in force," and if he "attempted to exercise the motion [sic] until the end of the leased period the statute would not have started to run until May 31, 1994."
[¶ 10] " `The application of the statute of limitations is a legal bar to a cause of action.' " Huber v. Oliver County, 529 N.W.2d 179, 182 (N.D.1995) (quoting Hagen v. Altman, 79 N.W.2d 53, 58 (N.D.1956)). "The statute of limitations begins to run when the underlying cause of action accrues." Huber, at 182. When, as here, the legislature has not defined when a cause of action has accrued, "it is for the judiciary to determine what controls the `accrual' of an action." Id.
[¶ 11] "Determining when a plaintiff's cause of action has accrued is generally a question of fact," Huber, 529 N.W.2d at 182, and a district court's determination "will not be overturned on appeal unless clearly erroneous," Jones v. Barnett, 2000 ND 207, ¶ 6, 619 N.W.2d 490. However, if "there is no dispute in the evidence about the facts, the question of whether the statute of limitations has run is for the court." Wells v. First Am. Bank West, 1999 ND 170, ¶ 7, 598 N.W.2d 834. See also American State Bank v. Sorenson, 539 N.W.2d 59, 62 (N.D.1995) ("Without a dispute of material fact, the trial court faced only a question of law on whether the statute of limitations barred the bank's claim.").
[¶ 12] " `A cause of action accrues when the right to commence it comes into existence; when it can be brought in a court of law without being subject to dismissal for failure to state a claim.' " Huber, 529 N.W.2d at 182 (quoting Keller v. Clark Equip. Co., 474 F.Supp. 966, 969 (D.N.D.1979)). We have recognized that a cause of action for breach of a lease accrues upon the first breach. Finstrom v. First State Bank of Buxton, 525 N.W.2d 675, 677-78 (N.D.1994).
[¶ 13] Abel acknowledged at oral argument that Allen breached the contract on Abel's first demand and he could have sued Allen upon that first refusal to comply with Abel's attempt to exercise the option. We agree, and we conclude the trial court did not err in ruling Abel's cause of action accrued in 1989 and his suit in May 2000 was barred by the statute of limitations.

III
[¶ 14] The judgment is affirmed.
[¶ 15] GERALD W. VANDE WALLE, C.J., WILLIAM A. NEUMANN, MARY MUEHLEN MARING, and CAROL RONNING KAPSNER, JJ., concur.
