This case involves the private use by an abutter of a forty-foot-wide unpaved extension of a public street leading to Hampton Beach. The plaintiff property owners contend that they *732made “improvements” to the extension of James Street pursuant to an agreement with the town selectmen. The selectmen later ordered the plaintiffs to abate these “improvements.” The plaintiffs, in turn, sought a permanent injunction against the enforcement of the town’s order. The injunction was granted after a hearing before a Master (R. Peter Shapiro, Esq.), whose report was approved by the Superior Court (Contas, J.). The town appealed. For the reasons which follow, we reverse and remand.
The record below reveals that James Street is used by the public and vehicles for access to Hampton Beach. The street runs in a general east-west direction. The portion of James Street closest to the beach is unpaved. On the north side of this unpaved section is property of one O’Shaughnessy, which is protected by a seawall along its property line fronting the beach. Originally, there was no seawall either at the beach end of James Street where it runs to the high-water mark, or on the south side of the street where the town-owned property borders the beach.
In July 1980, the plaintiffs entered into an agreement to purchase from the estate of Hazel Scribner a house known as 15 James Street. The house was built on land leased from the Town of Hampton which was located on the south side of James Street across from the O’Shaughnessy property. Because assignment of town leases required approval of the board of selectmen, the plaintiffs and the selectmen entered into a series of negotiations extending from July through September 22, 1980, concerning the use and occupancy of 15 James Street.
The master made certain findings with respect to these negotiations. First, he found that although the plaintiffs originally planned to construct a seawall only on the beach side of their property, the selectmen suggested that the proposed seawall be extended across James Street so as to connect with the seawall of the O’Shaughnessy property on the other side. The selectmen also suggested that the seawall be backfilled to the west for stability and that stairs be installed so that the public would have access over the wall to the beach. The plaintiffs agreed to these proposals and, in turn, requested that they be permitted to landscape the area behind the seawall within the unpaved section of James Street. The master specifically found in this regard that
“[permission was granted to landscape that area, provided a walkway was maintained to the beach. The Selectmen’s counterproposal was made to afford greater protection to the property owners in the vicinity of James Street from the ravages of the sea.”
*733At the September 22, 1980, meeting with the selectmen, a twenty-five-year lease was signed between the town and the plaintiffs for the property located at 15 James Street. The plaintiffs proceeded to make the various improvements in question. Besides the construction of the seawall across James Street where it ended at the beach, these improvements included the filling-in of the street behind the seawall, the planting of shrubs and trees, the addition of a paved pedestrian path along the northern side of James Street next to the O’Shaughnessy property, and the installation of a park bench in the vicinity of the paved path.
Photographic exhibits, which were part of the record, show that the effect of the “improvements” made by the plaintiffs was to reduce the forty-foot-wide extension of James Street into a pedestrian way and to divert foot travel to only that remaining portion of James Street closest to the O’Shaughnessy property. Furthermore, the plaintiffs constructed a deck as an addition to the former Scribner house which the town has alleged violates applicable zoning ordinances and extends into the portion of James Street in question.
In the spring of 1981, after having received complaints from persons in the neighborhood, the selectmen ordered the plaintiffs to remove the trees that had been planted in James Street, and otherwise to restore the right-of-way to its original condition except for the newly constructed seawall and attached stairs leading to the beach. The plaintiffs sought injunctive relief against the town from the enforcement of the order.
The master, however, found, after a view of the property, that the landscaping in the right-of-way was “tastefully done,” the planting of trees for privacy was consistent with plantings on the other side of the right-of-way, and that the landscaping and other improvements were consistent with what the parties had negotiated and agreed upon. The master determined that these negotiations resulted in two contracts between the parties: one for the lease of land and the second for the construction of the seawall and landscaping of the public way.
The master further found that the defendant selectmen “knew that plaintiffs did not own the . . . [Scribner house] at the time the application to construct a seawall. .. was made, and knew or should have known that the construction of the seawall and appurtenances thereto was a major consideration for the plaintiffs’ purchase of the leasehold interest and their improvement of the property.” The master recommended that the town be permanently enjoined from clearing or causing to be cleared the improvements in the public *734right-of-way which were made by the plaintiffs. This recommendation was approved by the superior court, and the injunction issued.
The town contends that the master’s report disregarded the law concerning the selectmen’s authority to curtail the use of a public highway or street. The town also disputes the master’s finding that a deck constructed as an addition to the plaintiffs’ house was properly authorized.
Generally, the law throughout the United States regarding encroachments on public streets is clear:
“A municipality cannot authorize a permanent encroachment, i.e., cannot confer power on abutters or others to occupy permanently a part of the street for a private use, unless such power has been expressly delegated by the legislature, and even then the property rights of abutters and nearby owners of adjoining property must not be infringed upon. If the municipality has no power to permit a particular use of the streets, such a use is unlawful and constitutes a nuisance.”
10 E. McQuillin, Municipal Corporations § 30.73, at 765 (3d rev. ed. 1981) (footnotes omitted). Selectmen in New Hampshire are given broad statutory authority to regulate the use of public highways and sidewalks. RSA 41:11 and 41:17, VII. However, the discontinuance of an established town highway is not favored, and may be accomplished only by vote of the town. Davenhall v. Cameron, 116 N.H. 695, 697, 366 A.2d 499, 500 (1976); RSA 231:43; see Williams v. Babcock, 121 N.H. 185, 194, 428 A.2d 108, 113 (1981).
Once a public highway is established, absent a valid discontinuation, travelers over it havA the right to do all acts reasonably incident to a “viatic use” of the road. Hartford v. Gilmanton, 101 N.H. 424, 426, 146 A.2d 851, 853 (1958) (citation omitted). Review of the record indicates that the entire length of James Street has been laid out by the town for public use, and such a road is considered a highway. See RSA 229:1. There v|as also testimony by the selectmen that the portion of James Street jin controversy had been used consistently over the years for vehicular access to the beach.
In the face of these facts, we hold that the effect of the plaintiffs’ improvement was the discontinuance of the highway and that such an abrogation of vehicular use could have been accomplished only by vote of the town. See RSA 231:43. Accordingly, we hold that insofar as the plaintiffs’ “improvements” interfere with the viatic use of James Street extension, such impediments are subject to *735abatement. Manchester v. Anton, 106 N.H. 478, 479-80, 213 A.2d 919, 920 (1965) (citation omitted).
In the alternative, the plaintiffs argue that if the “improvements” are subject to abatement, then they are entitled to damages for their reliance upon the representation of the selectmen which induced them to make the improvements.
Selectmen have the power to “manage the prudential affairs of the town” as prescribed by law, RSA 41:8, and to enter into contracts consistent with these purposes, see generally Town of Meredith v. Fullerton, 83 N.H. 124, 133, 129 A. 359, 364 (1927). However, this authority does not include the power to discontinue a public way, because such authority is reserved to the inhabitants to be exercised by vote of the town. RSA 231:43. Moreover, the authority of the selectmen relating to streets as set forth in RSA 41:11 does not include the authority to permit abutters to place shrubs or other permanent obstructions within a public way. Notwithstanding the master’s finding of fact that the selectmen and the plaintiffs contracted to build the seawall, and to landscape James Street in the manner done, the selectmen did not have the legal authority to barter away the greater portion of a public street by permitting the landscaping in question, without the required town vote.
Where a municipal governing body enters into a contract which is beyond the scope of the municipality’s powers, such an attempt to contract is termed ultra vires, and the contract is wholly void. C. Rhyne, Municipal Law § 10-3, at 257 (1957). Courts generally hold that no recovery may be had on a contract which is ultra vires. Id. at 258. “[A] person dealing with officers or agents of a municipality does so at his peril, and ... [it] is his duty to determine whether the parties with whom he is contracting were authorized to make the contract.” School Admins. Dist. #3 v. M.S.D.C. et al, 158 Me. 420, 425-26, 185 A.2d 744, 747 (1962); accord Storrs v. City of Manchester, 88 N.H. 139, 143-44, 184 A. 862, 864 (1936).
Nevertheless, there are exceptions to the rule denying the liability of a municipality under an ultra vires contract, where the municipality may be held liable on an implied contract for any benefits received. See Annot., 1 A.L.R.2d 338, 353-55 (1948); 10 E. McQuillin, The Law of Municipal Corporations § 29.10, at 238 (3d rev. ed. 1981). These exceptions depend upon the benefits received; if the benefits enrich the municipality with respect to a matter for which it had the power to contract, it may be held liable for the reasonable value of such a benefit. Annot., 84 A.L.R. 936, 965 (1933).
*736This court previously has held that where a municipal authority requests or retains and uses benefits, these actions would be conduct creating an obligation to pay for the fair worth of the service. Storrs v. City of Manchester, 88 N.H. at 144, 184 A. at 865; see also Skinner v. Manchester, 72 N.H. 299, 300-01, 56 A. 313, 314 (1903); cf. Michael v. City of Rochester, 119 N.H. 734, 736-37, 407 A.2d 819, 821 (1979) (whether contract was binding initially, because of failure to comply with procedures, did not affect the city’s obligation because city ratified and adopted the agreement).
In the instant case, the master found that pursuant to the “seawall contract” the plaintiffs acquired a valuable property right in the landscaped areas. Because the selectmen could not barter away the public’s right to unencumbered use of James Street, the contract was void and the plaintiffs could not acquire rights in the landscaped area. See Emporia v. Humphrey, 132 Kan. 682, 689-90, 297 P. 712, 717 (1931). However, the master found that the selectmen proposed that the seawall be extended across the public way to “afford greater protection to property owners within the vicinity of James Street from the ravages of the sea,” and the town could have properly contracted for the construction of the seawall to protect its citizens from the ravages of the sea. See RSA 41:8.
“A municipality . . . may be liable upon the principle of unjust enrichment when it has enjoyed the benefit of work performed and when no statute forbids or limits its power to contract therefor.” Hurdis Rlty., Inc. v. Town of North Providence, 121 R.I. 275, 278-79, 397 A.2d 896, 897-98 (1979) (citations omitted). Municipalities have been found liable for the benefits received where the work has been provided under a contract which is merely malum prohibitum, not malum in se. Village of McFarland v. Town of Dunn, 82 Wis. 2d 469, 478, 263 N.W.2d 167, 171 (1978). Accordingly, the plaintiffs may maintain an action in quantum meruit against the town for the value of the seawall extension and the steps attached thereto, and we remand for findings in regard to the fair value of these items provided for the benefit of the town. See R. Zoppo Co., Inc. v. City of Manchester, 122 N.H. 1109, 1113, 453 A.2d 1311, 1314 (1982).
The town also challenges the master’s findings that the deck which was built as an addition to the plaintiffs’ house was properly authorized and constructed pursuant to the zoning ordinance. In the instant case, the master decided the issue of whether the deck was constructed in accordance with the zoning ordinance “in order to avoid future litigation.” Notwithstanding the fact that this issue is *737not ripe for review because the town zoning board of adjustment has apparently never ruled on the matter, see RSA 31:69 through :77, insofar as the deck, as constructed, may also encroach on the public way, it is subject to abatement. See State v. Kean, 69 N.H. 122, 126-27, 45 A. 256, 257 (1896).
Reversed and remanded.
Bois, J., did not sit; the others concurred.