
838 P.2d 980 (1992)
114 N.M. 363
Kurt KOEHLER, Plaintiff-Appellee,
v.
Patrick DONNELLY, d/b/a Patrick Donnelly Landscape Company, Defendant-Appellant.
No. 20320.
Supreme Court of New Mexico.
September 3, 1992.
David P. Barton, Santa Fe, for defendant-appellant.
*981 Catron, Catron & Sawtell, P.A., Michael T. Pottow, Santa Fe, for plaintiff-appellee.

OPINION
FRANCHINI, Justice.
In this appeal we address whether a contractor was in substantial compliance with the Construction Industries Licensing Act, NMSA 1978, §§ 60-13-1 to -59 (Repl.Pamp. 1989) (CILA), despite an inadvertent lapse in his license prior to entering into and performing a construction contract. We hold that in this particular case the contractor was in substantial compliance and, therefore, could file a lien or use the courts to enforce a debt owed for work requiring a contractor's license pursuant to Section 60-13-30. For the reasons stated herein, we reverse the judgment of the trial court.

I.
Patrick Donnelly had been licensed by the New Mexico Construction Industries Division (CID) to perform roofing construction work since July 28, 1987. Prior to June 1990, Donnelly maintained a bond as proof of financial responsibility pursuant to Section 60-13-49.[1] A renewal notice from his bonding company requiring a seventy-five dollar premium was mailed July 5, 1990, and returned undelivered July 25. The bonding company subsequently sent notice of bond cancellation to the CID on August 13. On August 17, the CID mailed Donnelly notice of his bond cancellation and gave him thirty days to renew the bond or his license would be canceled. Donnelly did not receive the notice. His license was canceled effective September 16, and notice of the cancellation was mailed to him. Donnelly, again, did not receive this notice. All of the correspondence regarding Donnelly's license was mailed to his company's address. Because of his problems with mail delivery, he now receives his mail at a post office box.
In January 1991, Donnelly learned of the cancellation of his bond and immediately took steps to renew his proof of financial responsibility. Donnelly submitted a cash collateral and his license was reinstated effective January 26.
On December 2, 1990, Donnelly entered into a contract with Kurt Koehler for construction of a roof on Koehler's property. Koehler paid Donnelly $1,875, one-half of the contract price. Donnelly performed under the contract, and after making demand for payment of the balance, filed a notice of lien on May 5, 1991.
Koehler filed a complaint on July 9, 1991, seeking restitution, claiming breach of express and implied warranty, and alleging violations of the New Mexico Unfair Practices Act. Donnelly counterclaimed for lien foreclosure and breach of contract. The material facts were not in dispute and the trial court considered cross-motions for summary judgment, ruling in favor of Koehler and against Donnelly. The trial court found that Donnelly was not in compliance with the New Mexico licensing laws when he entered and completed the contract and that "licensure is the sine qua non for the maintenance of an action in a New Mexico court for foreclosure of a mechanic's lien or recovery on a contract." The trial court dismissed Donnelly's counterclaim and ordered judgment in favor of Koehler in the amount of $1,875.

II.
Donnelly argues that he was in substantial compliance with the CILA despite the cancellation of his license. Our legislature has chosen to harshly penalize unlicensed contractors by denying them access to the courts to collect compensation for work performed. Under Section 60-13-30, no contractor operating without a license may bring judicial action for compensation. Furthermore, the unlicensed contractor must return any amount received *982 as a result of the contracting work. Mascarenas v. Jaramillo, 111 N.M. 410, 414, 806 P.2d 59, 63 (1991).
Those harsh penalties are consistent with the purpose of the CILA. In Mascarenas, we stated that the purpose of the CILA is to accomplish:
a healthy, ordered market in which consumers may contract with competent, reliable construction contractors who have passed the scrutiny of a licensing division. The wrong to be remedied is the exploitation of the public by incompetent and unscrupulous contractors who are unable or unwilling to obtain a license. In effect, the wrongs to be remedied are circumstances which permit unlicensed contractors to flourish and profit at the expense of the public.
Id. at 413, 806 P.2d at 62. We have also characterized the CILA's purpose as protecting the public from "incompetent and irresponsible builders." Peck v. Ives, 84 N.M. 62, 66, 499 P.2d 684, 688 (1972). However, in exceptional circumstances, the purpose of the CILA is not furthered by strict enforcement. Thus, we have "been reluctant to construe the licensing statute more broadly than necessary to accomplish the purpose of the Act." Roth v. Thompson, 113 N.M. 331, 333, 825 P.2d 1241, 1243 (1992).
In Peck, this Court adopted the doctrine of substantial compliance to determine whether an unlicensed contractor has complied with the licensing requirements to the degree necessary to avoid bar from bringing suit. Peck, 84 N.M. at 65, 499 P.2d at 687. Following Latipac, Inc. v. Superior Court of Marin County, 64 Cal.2d 278, 49 Cal. Rptr. 676, 411 P.2d 564 (1966), the Court set out the following elements of the doctrine: (1) the contractor held a valid license at the time of contracting; (2) the contractor readily secured a renewal of that license; and (3) the responsibility and competence of the contractor's managing officer was officially confirmed throughout the period of performance. Peck, 84 N.M. at 65, 499 P.2d at 687.
In Latipac, all three elements were present. In Peck, we recognized that the California Supreme Court in Latipac left open the question of whether all of the elements necessarily had to exist in any one fact situation in order to apply the doctrine. Peck, 84 N.M. at 65, 499 P.2d at 687. The question left unanswered in Latipac was addressed in Asdourian v. Araj, 38 Cal.3d 276, 211 Cal. Rptr. 703, 696 P.2d 95 (1985). There the Supreme Court of California indicated that the failure to establish all of the Latipac factors need not defeat a contractor's claim inasmuch as the true test is "whether the contractor's `substantial compliance with the licensing requirements satisfies the policy of the statute.'" Asdourian, 211 Cal. Rptr. at 708, 696 P.2d at 100 (emphasis omitted) (quoting Latipac, 49 Cal. Rptr. at 676, 411 P.2d at 564). We agree.
The doctrine of substantial compliance was adopted because we do not insist on literal compliance in a situation where the party seeking to escape his obligation has received the full protection contemplated by the statute. Latipac, 49 Cal. Rptr. at 679, 411 P.2d at 567. The substantial compliance doctrine in both California and New Mexico has been applied in several factual situations. In Latipac, it was applied when a contractor's license expired before completion of a project. In Peck, we applied the doctrine where a licensed contractor exceeded the dollar limit of his construction license. In Roth, we did not apply the doctrine where the contractor was not licensed until after the contract was performed and the lien filed.
In Roth, as in Peck, we stated that a crucial element of substantial compliance is that the contractor hold a valid license at the time the contract is entered into. Roth, 113 N.M. at 333, 825 P.2d at 1243, Peck, 84 N.M. at 65, 499 P.2d at 687. Here, Donnelly did not hold a valid license at the time of contracting or at any time during performance. Yet, unlike the contractors in Roth and Mascarenas, Donnelly did not willfully enter into a contract in violation of the CILA. He obtained a license in 1987, and subsequently renewed it. He had no knowledge that his license had been canceled or even that it was in jeopardy. *983 The cancellation of his license occurred for reasons beyond his control and not for reasons of incompetence or discipline by the CID. He had no willfulness or knowledge of his violation and he was fiscally responsible and competent at all times during the performance of the contract. Therefore, Donnelly's failure to meet the first element of the test will not defeat his claim.
Donnelly fulfilled the second element by readily securing a renewal of his license. Once Donnelly learned that his license had been canceled, he took immediate steps and his license was reinstated. The Latipac court stated that: "renewal of its license after completion of performance lends confirmation to plaintiff's continuing competence and responsibility during the period of performance." Latipac, 49 Cal. Rptr. at 681, 411 P.2d at 569. Thus the concern under Latipac was whether the contractor's fitness to enjoy a license fluctuated in the interval between the expiration and renewal. Id. Upon receiving knowledge that his bond had inadvertently lapsed, Donnelly showed his fiscal responsibility by immediately submitting a cash collateral to replace the canceled bond pursuant to Section 60-13-49.
The third element addresses the fiscal responsibility and competence of the contractor's managing officer. Once again we consider Donnelly to have been both competent and fiscally responsible during the inadvertent lapse of his license. The lapse of the bond here is similar to what happened in Peck, although Peck's violation of the CILA was a knowing and voluntary act while Donnelly's was inadvertent. Peck took a job and continued construction even though he exceeded the dollar amount of the limitation on his license. Peck thus exceeded the amount of his assurance of financial responsibility under Section 60-13-49. In both cases, the contractor's client was left unprotected by the bond for the whole amount of the project. Yet, the client's rights could still be redressed through a claim for breach of contract. Also in Peck, financial responsibility was shown seven months after completion of the project by renewing his license for projects up to $100,000. Here, Donnelly complied a month after completion and immediately upon becoming aware of the default by renewing his proof of financial responsibility.
The provisions of the CILA are not intended to be used as "an unwarranted shield for the avoidance of a just obligation." Peck, 84 N.M. at 66, 499 P.2d at 688. We must not lose sight of the purpose of protecting the public from incompetent and irresponsible builders. Id. Donnelly's substantial compliance with the licensing requirements satisfied the policy of the CILA. Donnelly's competence and responsibility as a contractor was never jeopardized in this case and the public was, pursuant to the purpose of the CILA, protected.
Based on the foregoing, we reverse the order and judgment of the trial court and remand for further proceedings consistent with this opinion.
IT IS SO ORDERED.
RANSOM, C.J., and FROST, J., concur.
NOTES
[1]  Proof of financial responsibility can be shown by a bond, an agreement of cash collateral assignment executed with a bank or a current financial statement. § 60-13-49(B). The amount of responsibility to be shown is based on the dollar amount of the contracts singly performed. § 60-13-49(C). Donnelly was responsible for proof in the amount of $500. § 60-13-49(C)(1).
