
726 A.2d 310 (1999)
319 N.J. Super. 650
David L. WOOD, Plaintiff-Respondent,
v.
BOROUGH OF WILDWOOD CREST, Kevin Yecco, Mark Perka, Joyce Gould and Robert Saettler, Defendants-Appellants.
Superior Court of New Jersey, Appellate Division.
Argued February 1, 1999.
Decided April 1, 1999.
*311 Charles S. Epstein Vineland, for defendants-appellants (A. Michael Barker, attorney; David Sacks, Atlantic City, of counsel and on the brief with Jennifer L. Main).
Robert Herman, for plaintiff-respondent (Jacobs & Barbone, attorneys; Jeffrey S. McClain, on the brief).
Before Judges HAVEY, PAUL G. LEVY and LESEMANN.
The opinion of the court was delivered by HAVEY, P.J.A.D.
Defendants Borough of Wildwood Crest and its officials appeal from a summary judgment in plaintiff's favor declaring his entitlement to medical benefits as a retired police officer of the Borough. Before his retirement in 1993, plaintiff served twenty-two and one-half years on the police force. Because plaintiff had served four years in the United States Coast Guard, he was allowed to "buy back" the equivalent of two and one-half years to qualify for a full pension under the Police and Fireman's Retirement System. See N.J.S.A. 43:16A-11.1. Relying on a collective bargaining agreement with the Police Benevolent Association (PBA), the Borough determined that the "buy back" also entitled plaintiff to full medical insurance benefits upon his retirement. The Borough paid the benefits to plaintiff from January 1, 1993 until February 29, 1996. At that point it notified plaintiff that he was not entitled to continued medical benefits and accordingly terminated the benefits immediately. *312 See Wolfersberger v. Borough of Point Pleasant Beach, 305 N.J.Super. 446, 702 A.2d 1294 (App.Div.1996) (holding that a policeman's purchase of service credits to qualify for a pension cannot be credited towards twentyfive years of service to qualify for medical benefits under N.J.S.A. 40A: 10-23 as it read prior to a 1995 amendment to the statute), aff'd o.b., 152 N.J. 40, 702 A.2d 1284 (1997). The trial court held that the Borough was equitably estopped from terminating the benefits. We agree and affirm.
The facts are not in dispute. Plaintiff was entitled to a "special retirement" pension pursuant to N.J.S.A. 43:16A-11.1 by virtue of his twenty-two and one-half years of actual service with the Borough, and his payment into the Police and Fireman's Retirement System of the amount required to purchase two and one-half years of "service credit" to establish twenty-five years of "creditable service." N.J.S.A. 43:16A-11.1. At the time of plaintiff's retirement, Borough Ordinance No. 600 provided that the Borough would "assume the entire cost of coverage and group insurance premiums for retired employees and their dependents, to the extent authorized by [N.J.S.A.] 40A:10-23." On January 1, 1993, the effective date of plaintiff's retirement, N.J.S.A. 40A:10-23 read as follows:
Retired employees shall be required to pay for the entire cost of coverage for themselves and their dependents at rates which are deemed to be adequate to cover the benefits....
The employer may, in its discretion, assume the entire cost of such coverage and pay all of the premiums for employees who have retired on a disability pension or after 25 years' or more service with the employer, or have retired and reached the age of 62 or older with at least 15 years of service with the employer, including the premiums on their dependents, if any, under uniform conditions as the governing body of the local unit shall prescribe.
Plaintiff was covered by a collective bargaining agreement between the Borough and the PBA, which provided:
Upon retirement under the Police and Fireman's Pension System, the Borough shall provide the retiring employee and his/her family with all insurance coverage listed in Section 1 of this Article, and shall continue said coverage until the death of said employee, subject to the provisions of Article VI, Section 3.
Article II, Section 2 reads:
If any provision of this Agreement or any application of this Agreement to any employees or group of employees is held to be contrary to law, then such provisions and application shall not be deemed valid and subsisting except to the extent permitted by law.
Plaintiff testified during his deposition that he considered retirement as early as March 1992. His main concern was whether the Borough would continue his health care benefits if he retired before completing twentyfive years of actual service. He testified that, based on the collective bargaining agreement, he expected that his health benefits would continue after retirement. Nevertheless, sometime prior to retirement, he discussed the issue with the acting Chief of Police, who agreed that plaintiff would be entitled to continued health insurance benefits in accordance with the collective bargaining agreement.
Plaintiff was then referred to Mark Perka, the insurance liaison for the Borough; Robert Seattler, the Chief Financial Officer, and Kevin Yecco, the Borough Administrator. Each of these Borough representatives advised plaintiff that the continuation of plaintiff's health benefits would not be affected by his retirement. Plaintiff also met with the Borough Mayor to negotiate issues regarding reimbursement for sick time pay. According to plaintiff, at the meeting it was "confirmed [that he] would receive health benefits" upon his retirement.
In reliance on these assurances, plaintiff filed the requisite paperwork to "buy back" the two and one-half years of time in order to satisfy the twenty-five years of "creditable service" requirement for retirement. Plaintiff thereupon paid the New Jersey Division of Pensions the sum of $32,000 representing the amount he would have contributed if he had worked the full twenty-five years. See *313 N.J.S.A. 43:16A-11.11. On May 8, 1992, plaintiff took a medical leave of absence until December 31, 1992. His retirement became effective January 1, 1993. From that date through February 29, 1996, the Borough paid plaintiff's medical benefits totaling $62,772.62
The Legislature amended N.J.S.A. 40A:10-23, effective June 1995. The statute now reads:
The employer may, in its discretion, assume the entire cost of such [medical] coverage and pay all of the premiums for employees ... who have retired after 25 years or more of service credit in a State or locally administered retirement system....

[N.J.S.A. 40A:10-23 (emphasis added).]
In Wolfersberger, supra, 305 N.J.Super. 446, 702 A.2d 1294, we noted that under the retirement statute, N.J.S.A. 43:16A-11.11, an employee may satisfy the prerequisites for a "special retirement" pension by purchasing "credits" based on his or her service with the armed forces because that statute defines "eligibility for such a pension" in terms of "creditable service." Id. at 450, 702 A.2d 1294. We observed that, prior to the 1995 amendment to N.J.S.A. 40A:10-23, no comparable statutory provision authorized counting "creditable service" toward the twenty-five years of service called for by N.J.S.A. 40A:10-23, pertaining to the payment of health benefits to a retiree. Ibid. Nothing in the pre-amendment version of N.J.S.A. 40A:10-23 provided that anything but "service with the employer" could be credited toward the twenty-five years of service required to qualify for payment of health insurance premiums by a municipality. Ibid. Thus, we held that Wolfersberger's application for health insurance benefits was properly denied by the municipality.
According to the record, the 1995 amendment to N.J.S.A. 40A:10-23 caused the Borough to determine that, based on the preamendment version of the statute, plaintiff was not entitled to health benefits after his retirement. Thus, by letter dated December 20, 1995, the Borough terminated payment of the benefits immediately.
Plaintiff filed suit seeking a declaration that he is entitled to continued health benefits during his retirement. The Borough counterclaimed, seeking to recover the $62,772.62 paid on plaintiff's behalf for health benefits. The motion judge granted plaintiff summary judgment and dismissed the Borough's counterclaim, concluding that the Borough was estopped from terminating the benefits.
In Summer Cottagers' Ass'n of Cape May v. City of Cape May, 19 N.J. 493, 117 A.2d 585 (1955), our Supreme Court described the principle of estoppel in pais,[1] grounded in equity and justice, as embodying the doctrine:
that one may, by voluntary conduct, be precluded from taking a course of action that would work injustice and wrong to one who with good reason and in good faith has relied upon such conduct.
....
The doing or forbearing to do an act induced by the conduct of another may work an estoppel to avoid wrong or injury ensuing from reasonable reliance upon such conduct. The repudiation of one's act done or position assumed is not permissible where that course would work injustice to another who, having the right to do so, has relied thereon.
[Id. at 503-04, 117 A.2d 585.]
"`Equitable estoppel is rarely invoked against a governmental entity,'" County of Morris v. Fauver, 153 N.J. 80, 104, 707 A.2d 958 (1998) (quoting O'Malley v. Department of Energy, 109 N.J. 309, 316, 537 A.2d 647 (1987)), particularly when it would "prejudice essential governmental functions." Vogt v. Borough of Belmar, 14 N.J. 195, 205, 101 A.2d 849 (1954). Nevertheless, equitable considerations are relevant in assessing governmental conduct, Skulski v. Nolan, 68 N.J. 179, 198, 343 A.2d 721 (1975), and the doctrine may be invoked against a municipality "where the interests of justice, morality and common fairness clearly dictate that course." *314 Gruber v. Mayor and Tp. Comm., 39 N.J. 1, 13, 186 A.2d 489 (1962).
The Summer Cottagers' Court held that, in deciding whether or not to invoke equitable estoppel against a municipality, a court must focus on the nature of the action taken by the municipality:
There is a distinction between an act utterly beyond the jurisdiction of a municipal corporation and the irregular exercise of a basic power under the legislative grant in matters not in themselves jurisdictional. The former are ultra vires in the primary sense and void; the latter, ultra vires only in a secondary sense which does not preclude ratification or the application of the doctrine of estoppel in the interest of equity and essential justice.
[19 N.J. at 504, 117 A.2d 585.]
See also Gruber, supra, 39 N.J. at 15, 186 A.2d 489; Bridge v. Neptune Tp. Board of Adjust., 233 N.J.Super. 587, 597, 559 A.2d 855 (App.Div. 1989); Juliano v. Borough of Ocean Gate, 214 N.J.Super. 503, 508, 520 A.2d 418 (Law Div.1986).
An ultra vires contract has been defined as one which "is not within the power of a municipal corporation to make under any circumstances or for any purpose. A contract that is merely the result of a defective exercise of existing authority is not ultra vires." 10 McQuillin Municipal Corporations § 29.10 (3rd Ed.1999) (emphasis added). However, the term "ultra vires," used in the context of municipal law, has engendered some confusion in its application. See ibid. and cases cited therein. In the circumstances of a particular case, Summer Cottagers' Ass'n`s "primary/secondary" distinction may become obscured.
For example, in Summer Cottagers' Ass'n, supra, the city sold public land not needed for public use, but failed to comply with several statutory requirements which "vitiated the statutory policy of public notice and free competitive bidding." 19 N.J. at 498, 117 A.2d 585. The Court nevertheless refused to set aside the sale, noting that although the "original rule" that a contract "void ab initio" was not subject to being validated by ratification or estoppel, the rights of persons innocently entering into municipal contracts had to be considered in order to avoid manifest injustice and legal wrong. Id. at 505-06, 117 A.2d 585. Noting that the challenge to the sale was made only after the "erection of a structure of great value," the Court determined that the sale was "within the municipality's essential jurisdiction[,]" id. at 506, 117 A.2d 585, and that elemental justice compelled invoking estoppel despite noncompliance with the statutory requirements. Ibid.
The Summer Cottagers' Ass'n dichotomy has been applied in the zoning field. In Jantausch v. Borough of Verona, 41 N.J.Super. 89, 94-95, 124 A.2d 14 (Law Div.1956), aff'd, 24 N.J. 326, 131 A.2d 881 (1957), then Judge Weintraub held that when a municipal official issues a building permit in good faith and, within the ambit of his duty, makes an erroneous and debatable interpretation of an ordinance, estoppel will lie if the property owner reasonably relies on the permit. In Scardigli v. Borough of Haddonfield Zoning Board of Adjust., 300 N.J.Super. 314, 319-20, 692 A.2d 1012 (App.Div.1997), we held that a municipality may be estopped if there is reasonable reliance on a good faith act of an administrative official, within the ambit of his or her official duty, which "constitutes an erroneous and debatable interpretation of an ordinance." And see Township of Fairfield v. Likanchuk's, Inc., 274 N.J.Super. 320, 332, 644 A.2d 120 (App.Div.1994) and cases cited therein. But see Hilton Acres v. Klein, 35 N.J. 570, 581, 174 A.2d 465 (1961) (stating that "municipal action in the land use control field taken in direct violation of law or without legal authority is void ab initio and has no legal efficacy").
Summer Cottagers' Ass'n`s analysis has also been applied in other contexts. For example, in O'Neill v. State, Dep't of the Treasury, 178 N.J.Super. 211, 214, 428 A.2d 562 (App.Div.1981), we held, citing Summer Cottagers' Ass'n that, the Board of Trustees of the Public Employees Retirement System was not estopped from denying petitioner retirement eligibility where there is "an absolute and unambiguous statutory declaration which deprives the agency of jurisdictional *315 authority to award pension benefits under the circumstances."
In contrast, in Galvano v. Board of Trustees, 225 N.J.Super. 388, 542 A.2d 926 (App. Div.1988), a sixty-one year old municipal employee applied for veteran's retirement, effective October 1, 1984. The Board of Trustees of the Public Employees Retirement System approved his application. Id. at 390, 542 A.2d 926. The Division of Pensions thereafter advised the employee that he was ineligible for veteran's retirement because he had not attained his sixtysecond year as of October 1, 1984, and that his application was being processed as a "service" rather than veteran's retirement. Ibid. The employee asked the Division to "reverse the mistake that [he] made when he accepted" the service retirement benefits and award him veteran's benefits as of June 5, 1985, his sixty-second birthday. Ibid. We reversed the Board's denial of that application, noting that equitable factors must enter into the equation even in circumstances where the pension was improper. We concluded that the Board:
clearly had jurisdiction to approve [the veteran's] pension request, although its approval was incorrectly exercised in light of the age 62 requirement of N.J.S.A. 43:15A-61(b). The Board's inherent power to correct its mistake was subject, however, to the equitable considerations spelled out in Skulski, [supra, 68 N.J. at 179, 343 A.2d 721].
[Id. at 395, 542 A.2d 926.]
Finally, in Juliano, supra, 214 N.J.Super. 503, 520 A.2d 418, the defendant borough asserted that its acting chief's original appointment as a regular police officer was void ab initio because, at the time of the appointment, she did not comply with the maximum age requirement under N.J.S.A. 40A:14-147. Citing Summer Cottagers' Ass'n, Judge Serpentelli held that the borough was estopped from asserting the illegality, despite the clear statutory violation in the application process. He observed:
the right of Ocean Gate to appoint police officers is not questioned. N.J.S.A. 40A:14-118. It exercised that essential power and therefore did not act ultra vires in the primary sense. Its failure to abide by the age requirement is more accurately described as "an irregular exercise of a basic power" as opposed to "an act utterly beyond its jurisdiction." Consequently it is, at most, ultra vires in the secondary sense.
[Juliano, supra, 214 N.J.Super. at 508-09, 520 A.2d 418 [(citation omitted).]]
The judge reasoned that "a finding that plaintiff's appointment is ultra vires in the primary sense and thus void would result in a gross injustice[,]" id. at 510, 520 A.2d 418, noting the absence of fraud, the borough's failure to raise the issue in a timely fashion, plaintiff's reliance, and that there was no showing that the legitimate policy justifications for the age limitation had been frustrated. Id. at 509-10, 520 A.2d 418.
What is gleaned from Summer Cottagers' Ass'n and the subsequent cases is that, in many instances, as here, the facts of a particular case may not fit neatly within the ultra vires "primary or secondary" designations as set forth in Summer Cottagers' Ass'n. In such circumstances, the court must consider whether "equity and elemental justice," Summer Cottagers' Ass'n, supra, 19 N.J. at 506, 117 A.2d 585, precludes a municipality's abrogation of its act, provided that application of estoppel does not frustrate an essential governmental function.
Plaintiff presents a persuasive argument that the facts before us do not involve an act "utterly beyond the jurisdiction of the Borough, id. at 504, 117 A.2d 585, and that the case does not involve "an absolute and unambiguous statutory declaration which deprives" the Borough from awarding health benefits to plaintiff. O'Neill, supra, 178 N.J.Super. at 214, 428 A.2d 562. A municipality is empowered to enter into contracts for group hospitalization and medical insurance on behalf of its employees. N.J.S.A. 40A:10-17. At the time of plaintiff's retirement, it also had the discretion to provide such benefits to a retiring employee who had "25 years' or more service with the employer."
While it is true that plaintiff did not comply strictly with the then pertinent requirement *316 of serving "25 years' or more service with the [Borough]," that language at the time was the subject of fair debate; it was unclear whether "service with the employer," may include "creditable service" afforded to veterans pursuant to N.J.S.A. 43:16A-11.1. There was no judicial determination as to the meaning of the language until our 1996 decision in Wolfersberger. Moreover, the record is clear that the Borough officials, in granting the benefits to plaintiff, relied in good faith on the Borough's own ordinance and the PBA collective bargaining agreement which provided that, upon the retirement of a police officer, "the Borough shall provide the retiring employee and his/her family with all insurance coverage listed ...." under the terms of the agreement. (Emphasis added). Plaintiff makes the compelling argument that the grant of benefits to him constituted an "irregular exercise of a basic power...." Summer Cottagers' Ass'n, supra, 19 N.J. at 504, 117 A.2d 585.
To label the contract as ultra vires in the primary sense and thus void would, as in Juliano, supra, constitute a "gross injustice." 214 N.J.Super. at 510, 520 A.2d 418. There is no suggestion here that bad faith or fraud was in play in the grant of benefits to plaintiff. There is also no question that plaintiff reasonably relied on the representations of the Borough. Prior to his retirement he asked at least five Borough officials, from the acting Chief of Police to the Mayor, whether he would be entitled to health benefits upon his retirement. All of the officials assured him that, in accordance with the collective bargaining agreement, he would be entitled to the benefits. There is also no question that he suffered a detriment in relying on the Borough's assurances. Once he was assured of his eligibility for continued health benefits, he paid over $32,000 to achieve a "special" retirement in buying back the requisite two and one-half years to satisfy the retirementeligibility requirements. He testified that his eligibility for health benefits was critical to his decision whether or not to retire. Had he been told otherwise, he could have deferred retirement until he had twenty five years of actual service with the Borough.
Finally, applying estoppel here does not frustrate an essential public function. There is no suggestion that the award to plaintiff resulted in a raid on the Borough's treasury by others, similarly situated, demanding benefits. Moreover, the legislative policy requiring twenty-five years of actual service with a municipality was tempered by the 1995 amendment to N.J.S.A. 40A:10-23, which now gives the municipal employer the discretion to grant benefits to retiring employees in plaintiff's circumstances. Fundamental fairness dictates in favor of applying equitable estoppel against the municipality in these circumstances.
Affirmed.
NOTES
[1]  In modern usage the doctrines of equitable estoppel and estoppel in pais are convertible terms. Anske v. Borough of Palisades Park, 139 N.J.Super. 342, 348, 354 A.2d 87 (App.Div. 1976).
