
685 P.2d 94 (1984)
MUNICIPALITY OF ANCHORAGE, Appellant,
v.
Richard J. SCHNEIDER and Mary M. Schneider, Appellees.
No. S-63.
Supreme Court of Alaska.
July 6, 1984.
*95 Thomas F. Klinkner, Asst. Municipal Atty., Jerry Wertzbaugher, Municipal Atty., Anchorage, for appellant.
Karl L. Walter, Jr., Anchorage, for appellees.
Before BURKE, C.J., and RABINOWITZ, MATTHEWS, COMPTON and MOORE, JJ.

OPINION
MATTHEWS, Justice.
The Municipality of Anchorage appeals the trial court's determination that the Municipality cannot revoke a building permit issued to appellees even though the permit was issued in violation of a zoning ordinance. Judge Souter held that Richard and Mary Schneider, the appellees, had reasonably relied on the permit and therefore the Municipality was estopped from revoking it. We affirm.

I.
The Schneiders own a lot in the Fire Lake Subdivision in Eagle River which was zoned R-2 by the Municipality until August 20, 1982. This zoning classification allows construction of up to eight dwelling units per lot, provided the units are incorporated into a single structure. On July 7, 1982 the Municipality brought an action against the Schneiders for maintaining two detached dwelling units on their lot, a violation of Anchorage Municipal Code (AMC) 21.40.040.[1]
In September, 1982, consistent with an agreement reached at a settlement conference *96 attended by Richard Schneider, his attorney, and representatives of the Municipality, the Schneiders were issued a permit to construct an additional three units on their lot in order to connect the two existing detached dwelling units. Both the settlement agreement and the issuance of the permit, however, occurred after the Schneiders' lot and the surrounding property had been rezoned R-2A. In an R-2A zoning district, a lot may not contain more than two dwelling units.[2] None of the parties at the settlement meeting knew that the area in question had been rezoned.
On February 28, 1983, having discovered its error, the Municipality revoked the Schneiders' building permit. The Schneiders then filed a motion in superior court to enforce their settlement agreement with the Municipality. The court found that, although construction had not yet begun, the Schneiders had spent approximately $24,000 in reasonable reliance on the Municipality's representations embodied in the settlement agreement. The court concluded that the Municipality was estopped from revoking the building permit it had issued and that it was bound by the settlement agreement to allow the Schneiders to complete three additional dwelling units on their lot.

II.
The traditional rule is that estoppel may not be invoked against a municipality which has erroneously issued a building permit in violation of its zoning ordinances. 9 E. McQuillan, The Law of Municipal Corporations § 26.213, at 545 (3d ed. rev. 1978); 3 A. Rathkopf, The Law of Zoning & Planning § 45.05[3][a] (4th ed. 1983). This rule is based on the proposition that a person dealing with a municipality is bound to take notice of the legal limits of its powers and those of its agents. 10 E. McQuillan, supra, § 29.04, at 207-08; see also King v. Alaska State Housing Authority, 512 P.2d 887, 891 (Alaska 1973) ("all persons dealing with a public corporation ... are deemed to know its limitations.").[3]
At least one commentator, and a growing number of courts, have questioned this rule on the ground that its application often produces inequitable results. 2 C. Antieau, Municipal Corporation Law § 16A.05, at 16A-12 (1984).[4] Antieau points out that
[t]he average citizen simply cannot know the extent of authority of every public official with which he must deal, and it is outrageous to deny him justice when he has been misled to his detriment by the acts and statements of public officials within the contours of their responsibilities.
Id. In the particular context of zoning permits, Antieau states:
[I]t is suggested that there should be no general rule denying estoppel solely because *97 a permit issued by a municipal officer turns out to have been issued illegally or without authority ... [A] good faith permitee who in reasonable reliance makes a substantial change of position should be entitled to the protection of the doctrine of estoppel... . Increasingly, courts are recognizing the justice of applying estoppel where substantial work has been done in reliance upon municipal permits that were issued illegally or impermissibly.
Id., § 16A.10, at 16A-22-23 (footnotes omitted).
The policy on which the rule of estoppel is founded is that a municipality acts for the good of its citizens rather than a narrow proprietary interest. Thus, the argument goes, it would be unjust to the public to enforce estoppel against a municipality.[5] While we recognize the general validity of this policy, we believe it can be adequately served within the doctrine of estoppel.
The general elements of equitable estoppel are (1) assertion of a position by conduct or word, (2) reasonable reliance thereon, and (3) resulting prejudice. Jamison v. Consolidated Utilities, Inc., 576 P.2d 97, 102 (Alaska 1978). A fourth element, most often explicitly stated in promissory estoppel cases, is that the estoppel will be enforced only to the extent that justice so requires. Glover v. Sager, 667 P.2d 1198, 1202 (Alaska 1983). We believe that this factor should play an important role when considering estoppel against a municipality.[6] Often, even where reliance has been foreseeable, reasonable, and substantial, the interest of justice may not be served by the application of estoppel because the public interest would be significantly prejudiced. However, this is not true in every case. When the public will not be significantly prejudiced, and the other elements of the theory are present, the majority rule which forecloses the use of estoppel causes arbitrary and unjust results.
We have recently indicated that estoppel is a defense against a public agency. In Fields v. Kodiak City Council, 628 P.2d 927, 931 (Alaska 1981), we stated:
The defense [of estoppel] typically applies where a property owner receives a permit that was beyond the power of an administrative officer to grant, the owner detrimentally relies on the validity of the permit, and the local government attempts to revoke the permit and then enforce the ordinance.
While we rejected Fields' estoppel claim as irrelevant to the issue presented on appeal of whether the board of adjustment's denial of the requested variance was supported by substantial evidence, we noted:
We do not mean to imply, however, that Fields is not entitled to estop the city or borough from actually enforcing the zoning ordinance against his nonconforming use. Indeed, on the limited record before us it appears that Fields may have a strong claim for estoppel. That claim, however, should be raised as a defense to an enforcement action or as a claim for declaratory relief. Our disposition of this case is without prejudice to *98 Fields' right to raise estoppel in an appropriate proceeding.
Id. at 931 n. 3.
We now turn to the facts of the present case. First, we believe that the Schneiders' reliance was both reasonable and foreseeable. The settlement agreement and the resulting permit gave the Schneiders clear authorization to take the steps they did. Second, the $24,000.00 which the Schneiders spent for building materials based upon their reliance on the settlement agreement is substantial.
Finally, we conclude that enforcement of the settlement agreement is necessary in the interest of justice. Of primary importance to this determination is the fact that any public injury which may arise from applying the doctrine of estoppel to the Municipality in this case is quite limited. The proposed structure will not violate health or safety codes. Further, the proposed structure would have satisfied the terms of the zoning ordinance then in effect had the settlement been reached a month earlier.[7] Finally, the record contains no evidence that the Schneiders' proposed construction will be seriously out of character with the present structures in the area.
Also of significance in this case is the fact that the Schneiders' reliance arose from a settlement agreement. There is a strong public policy in favor of the settlement of disputes. See, e.g., Godfrey v. Hemenway, 617 P.2d 3, 8 (Alaska 1980). Failure to apply an estoppel theory in this case would only serve to re-open a lawsuit that both parties believed was settled. Indeed, although actually reached after the property in question had been rezoned R-2A, the settlement agreement arose out of a lawsuit filed in July 1982, when the property was zoned R-2. Thus, given the equitable context of this case, the settlement agreement could be characterized as relating back to the situation existing when the suit was initiated.
In conclusion, we believe this case raises a situation in which the doctrine of estoppel should be applied against the Municipality to avoid injustice. Thus, the decision of the superior court is AFFIRMED.
NOTES
[1]  AMC 21.40.040 provides in part:

A. The R-2 use district is intended to be a low-density urban and suburban multiple-family residential district, allowing up to 8 dwelling units... . The R-2A and R-2D use districts are intended as low-density urban and suburban two-family residential areas. Except for the greater number of dwelling units per lot permitted in the R-2 use district, the R-2, R-2A and R-2D use regulations are identical... .
B. Permitted principal uses and structures:
1. single-family dwellings ...;
2. two-family dwellings (only a single principal structure may be allowed on any lot or tract);
3. multiple-family dwellings containing up to eight dwelling units in R-2 district only, provided, however, that only a single principal structure may be allowed on any lot or tract;
[2]  AMC 21.40.040B(2). See note 1, supra.
[3]  Courts have allowed estoppel against municipalities when the public officer has performed in an irregular manner, but has not acted ultra vires or outside his legal authority. See Rogers v. First Sewerage Dist. of City of Lake Charles, 171 So.2d 820 (La. App. 1965); Parker v. Township of West Bloomfield, 60 Mich. App. 583, 231 N.W.2d 424, 428 (1975); Abbeville Arms v. City of Abbeville, 273 S.C. 491, 257 S.E.2d 716 (1979); Pasadena Police Officers Ass'n.v. City of Pasadena, 497 S.W.2d 388, 394 (Tex.Civ.App. 1973); 2 C. Antieau, Municipal Corporation Law § 16A.04 (1984); see also City of Kenai v. Filler, 566 P.2d 670, 675-76 (Alaska 1977) (noting the distinction between an illegal, ab initio action not giving rise to estoppel and a technical or procedural irregularity which does give rise to the theory).
[4]  See also City & County of Denver v. Stackhouse, 135 Colo. 289, 310 P.2d 296 (1957); Miller v. Board of Trustees of Town of Palmer Lake, 36 Colo. App. 85, 534 P.2d 1232 (1975); State ex rel. Barker v. Town of Stevensville, 164 Mont. 375, 523 P.2d 1388 (1974); Murrell v. Wolff, 408 S.W.2d 842 (Mo. 1966); Tillberg v. Township of Kearny, 103 N.J. Super. 324, 247 A.2d 161, 166 (1968).
[5]  The Wisconsin Supreme Court has stated this policy as follows:

Zoning ordinances are enacted for the benefit and welfare of the citizens of a municipality. Issuance of an occupancy or building permit which violates such an ordinance not only is illegal per se, but is injurious to the interests of property owners and residents of the neighborhood adversely affected by the violation. Thus when the city acts to revoke such an illegal permit it is exercising its police power to enforce the zoning ordinance for the protection of all citizens who are being injured by the violation, and not to protect some proprietary interest of the city. These citizens have a right to rely upon city officials not having acted in violation of the ordinance, and, when such officials do so act, their acts should not afford a basis for estopping the city from later enforcing the ordinance.
Milwaukee v. Leavitt, 31 Wis.2d 72, 142 N.W.2d 169, 172-73 (1966).
[6]  See 2 Antieau, supra, § 16A.06, at 16A-15 ("courts should be encouraged to weigh in every case the gravity of the injustice to the citizen if the doctrine is not applied against the injury to the commonweal if the doctrine is applied... ."); see also State ex rel. Barker v. Town of Stevensville, 164 Mont. 375, 523 P.2d 1388, 1391 (1974).
[7]  Thus the case at hand does not present a situation where a building permit has been issued in violation of a long-standing zoning ordinance, for example, where a builder obtains a permit to construct a high-rise apartment or factory in an otherwise residential neighborhood. In such a case, the balance of the equities might be struck differently.
