
571 N.W.2d 323 (1997)
6 Neb. App. 115
Mark L. SPRINGER and Carole D. Springer, Husband and Wife, Appellees,
v.
JoAnn C. KUHNS, Appellant.
No. A-96-562.
Court of Appeals of Nebraska.
October 21, 1997.
*325 Kent F. Jacobs, of Blevens & Jacobs, Seward, for appellant.
Mark J. Krieger, of Bowman & Krieger, Lincoln, for appellees.
MILLER-LERMAN, C.J., and SIEVERS and MUES, JJ.
SIEVERS, Judge.
This opinion addresses the effect the passage in 1995 of L.B. 251, now codified as Neb.Rev.Stat. § 46-691 (Cum.Supp.1996), had on the validity of an agreement reached in 1989 to transfer ground water off overlying land to an adjacent tract for agricultural purposes. Inherent in this determination is the recitation of some history of ground water law and an examination of the intent of the Legislature in enacting L.B. 251.

FACTUAL BACKGROUND
In 1989, Mark L. Springer and Carole D. Springer owned approximately 80 acres located in the east half of the northwest quarter of Section 18, Township 9 North, Range 3 East of the 6th P.M., in Seward County, Nebraska (hereinafter the north 80 acres). In the late summer or early fall of that year, the Springers were approached by JoAnn Kuhns' husband, Eldon Kuhns, who was operating under a durable power of attorney on behalf of his wife. Eldon Kuhns expressed a desire to purchase an easement across the above-mentioned north 80 acres, but no purchase was completed.
Thereafter, the Springers purchased 152 acres of the southwest quarter immediately south of the north 80 acres. After this purchase, the Springers offered to sell the north 60 acres of the north 80 acres to JoAnn Kuhns. This was the same tract of land where Eldon Kuhns had earlier sought to secure an easement. This initial offer to sell was limited to the north 60 acres because the south 20 acres contained a well which was important to the Springers. This well fed an underground pipe attached to an irrigation system in the newly purchased 152 acres of the southwest quarter and enabled the Springers to irrigate the southwest quarter. JoAnn Kuhns refused to purchase less than the entire north 80 acres, but offered to give the Springers an easement if she purchased the entire north 80 acres so that they could continue to draw water from the well on the property and irrigate their new 152-acre tract. The Springers agreed to this proposal, and the parties entered into a purchase agreement on November 14, 1989, containing this language:
Seller as grantor retains all water rights in and to the south 20 acres of the above-described real estate, for the use upon real estate described as the Southwest Quarter (SW ¼).... Grantor further retains an easement over and across that portion of the south 20 acres ... for access, maintenance and repair to an irrigation pipeline and related equipment to the existing or replacement well located thereon.
The property was thereafter conveyed by warranty deed dated December 28, 1989, in which the following reservation was made with regard to water rights:
Grantor retains all water rights in and to the south 20 acres of the above-described real estate.... Grantor further retains an easement over and across that portion of the south 20 acres of the real estate ... for access, maintenance and repair to an irrigation pipeline ... or replacement well.... This easement and retention of water rights shall be appurtenant to the real estate described as the Southwest Quarter (SW ¼)....
JoAnn Kuhns honored the Springers' easement for 5 years, until Mark Springer considered accepting an offer to enter into a lease agreement to cash-rent 40 acres from *326 another farmer who had worked with Eldon Kuhns. The Springers allege that Eldon Kuhns, upon discovering the other farmer's offer to lease to the Springers, threatened to cut off the Springers' water supply from the well. This threat was set forth in a letter from JoAnn and Eldon Kuhns' counsel to the Springers' counsel, which stated,
Since Mr. Springer has chosen to interrupt Mr. Kuhn's [sic] farming operation at other locations, Mr. Kuhns no longer recognizes the reservation of water rights stated in the deed to said East Half of the Northwest Quarter of 18-9-3. Therefore, Mr. Springer is not authorized to enter the premises for the purposes of turning on the well during the 1994 crop year.
Following these threats, and fearing that their southwest quarter acreage was about to become dry land corn cropland rather than irrigated corn cropland, the Springers drilled a test well in the southwest quarter, which found water. Within 1 month of the Springers' drilling the test well, Eldon Kuhns drilled and installed a submersible 150-gallon domestic well within 1,000 feet of the Springers' test well. The Springers contend this was done to eliminate their development and use of the test well because it is necessary for a well to be 1,000 feet from an existing well to obtain natural resources district approval. This action, according to the Springers, forces them to drill farther into their property and away from the Ogallala aquifer where water is readily found.

PROCEDURAL BACKGROUND
The Springers sued JoAnn Kuhns in the district court for Seward County, asking alternatively for rescission of the warranty deed due to a mutual mistake of the parties, rescission of the deed due to fraud, or reformation of the deed and an order quieting title in them to the retention of the water rights. JoAnn Kuhns answered and counterclaimed, alleging that "the reservation ... of water rights and of rights to drill a replacement well [is] void as against public policy as an attempt to alienate water rights for private usage, and should be stricken from [the] deed." JoAnn Kuhns asked the court to quiet title in her to the water rights.
The Springers also applied for a temporary injunction, which was granted. In granting the temporary injunction, the court set forth that it could "find no authority which prohibits such reservation of water rights and access. Such situation is analogous to the reservation of mineral rights by deed, which is recognized by Nebraska law."
After a bench trial, the court decreed that it "hereby quiets title in [the Springers] in and to water rights and an easement in the [north 80 acres] pursuant to a Warranty Deed...." The easement was equitably reformed to comply with the agreement of the parties and was restated as follows by the court:
"Grantor retains all water rights in and to the South twenty acres of the above-described real estate for the use upon the real estate described as the Southwest 1/4 of Section 18, Township 9 North, Range 3 East of the 6th P.M., Seward County, Nebraska. Grantor further retains an easement over and across that portion of the South twenty acres of the real estate conveyed hereunder for access, maintenance, use and repair to an underground irrigation pipeline and related equipment and to the existing or replacement well located thereon. Grantor's easement hereunder includes the right to draw water from the well located on the property herein described through the existing or replacement well, and transmit that water through the existing or replacement underground pipeline located upon said property. Grantor further retains an easement for the purpose of drilling a replacement well for the existing well upon the South twenty acres; provided that Grantor agrees that any such future replacement well shall not be constructed in such a way as to impede any center pivot irrigation system used upon Grantee's land. Grantor further agrees to pay Grantee for any loss to crops occasioned by maintenance, repair or replacement of said well, underground irrigation pipeline, and related equipment. This agreement and retention of water rights shall be appurtenant to the real estate described as the Southwest ¼ of Section 18, Township 9 North, Range 3 *327 East of the 6th P.M., Seward County, Nebraska."
(Emphasis supplied.) JoAnn Kuhns and her agents were permanently enjoined from interfering in any way with the Springers' easement, and her counterclaim was dismissed with prejudice. JoAnn Kuhns then appealed to this court.

ASSIGNMENTS OF ERROR
JoAnn Kuhns assigns error to the trial court in that it (1) erred in finding that the reservation of water rights is a legal title which can be severed from the ownership of the overlying land and (2) erred in granting injunctive relief to the Springers when such relief was neither pled nor prayed for in their petition.

STANDARD OF REVIEW
In an appeal from an equitable action, the reviewing court reviews the action de novo on the record and reaches a conclusion independent of the factual findings of the lower court, subject to the rule that where credible evidence is in conflict on material issues of fact, the reviewing court may consider and give weight to the fact that the trial court observed the witnesses and accepted one version of the facts over another. Omega Chem. Co. v. United Seeds, 252 Neb. 137, 560 N.W.2d 820 (1997); Sid Dillon Chevrolet v. Sullivan, 251 Neb. 722, 559 N.W.2d 740 (1997). We find no dispute of consequence in the facts, and therefore, we approach the matter as a question of law.

ANALYSIS
The early development of water law in Nebraska centered on judicial pronouncements rather than legislative enactments. In the important case Olson v. City of Wahoo, 124 Neb. 802, 248 N.W. 304 (1933), the Nebraska Supreme Court rejected the English common-law rule of ownership and adopted instead the American rule that
the owner of land is entitled to appropriate subterranean waters found under his land, but he cannot extract and appropriate them in excess of a reasonable and beneficial use upon the land which he owns, especially if such use is injurious to others who have substantial rights to the waters....
Id. at 811, 248 N.W. at 308. The Nebraska Supreme Court then modified the American rule by holding, "[I]f the natural underground supply is insufficient for all owners, each is entitled to a reasonable proportion of the whole...." Id. The right to use ground water, then, is in large part tied to ownership of the overlying land. Nebraska's common law was that ground water could not be transferred off overlying land. Ponderosa Ridge LLC v. Banner County, 250 Neb. 944, 554 N.W.2d 151 (1996) (mentioning that transportation of ground water from underlying land for any use, whether interstate or intrastate, is severely curtailed and that transportation of ground water for intrastate use is prohibited except for specific statutory exceptions).
The Legislature passed no laws regulating ground water until 1957. In that session, the Legislature provided for the registration of irrigation wells, the spacing of wells, and preferences for the use of ground water. See, Neb.Rev.Stat. § 46-602 (Cum.Supp.1996); Neb.Rev.Stat. § 46-609 (Reissue 1993); Neb.Rev.Stat. § 46-613 (Cum.Supp.1996). At the time the purchase agreement between JoAnn Kuhns and the Springers was executed on November 14, 1989, the specific statutory exceptions to the common law of ground water transfer were contained in Neb.Rev.Stat. §§ 46-638 through 46-650 (Reissue 1988) (Municipal and Rural Domestic Ground Water Transfers Permit Act) and Neb.Rev.Stat. §§ 46-675 through 46-690 (Reissue 1988) (Industrial Ground Water Regulatory Act). The Municipal and Rural Domestic Ground Water Transfers Permit Act sets forth:
The Director of Water Resources of the State of Nebraska is hereby authorized to grant and administer permits to public water suppliers: (a) To locate, develop, and maintain ground water supplies through wells or other means and to transport water into the area to be served and (b) to continue existing use of ground water and the transportation of ground water into the area served.
*328 § 46-638. "An applicant which desires to avail itself of [this act] shall make application in writing to the Director of Water Resources for a permit." § 46-639. "The use of ground water pursuant to a permit ... shall be subject to and governed by the provisions of section 46-613." § 46-648.
Section 46-613 states that preference in the use of ground water shall be given to those using the water for domestic purposes, but that those using the water for agricultural purposes shall have preference over those using the same for manufacturing or industrial purposes. In Sorensen v. Lower Niobrara Nat. Resources Dist., 221 Neb. 180, 190, 376 N.W.2d 539, 547 (1985), the Nebraska Supreme Court noted, "By enacting the Municipal and Rural Domestic Ground Water Transfers Permit Act as a part of Nebraska's policy, the Legislature altered certain aspects of common law governing use of ground water. Permitees under the act are exonerated from the common-law prohibition against transfer and transportation of ground water." See, also, State ex rel. Douglas v. Sporhase, 208 Neb. 703, 706-07, 305 N.W.2d 614, 617 (1981) ("[s]ince the Nebraska common law of ground water permitted use of the water only on the overlying land, legislative action was necessary to allow for transfers off the overlying land, even for as pressing a need as supplying urban water users.... [T]he Legislature has the power to determine public policy with regard to ground water and ... it may be transferred from the overlying land only with the consent of and to the extent prescribed by the public through its elected representatives"), reversed on other grounds 458 U.S. 941, 102 S.Ct. 3456, 73 L.Ed.2d 1254 (1982).
Sorensen, supra, makes it clear that the landowner's right to use ground water is an appurtenance to the ownership of the overlying land, but that ground water use is not an unlimited private property right under Nebraska law. Because the common law restricted transfer of ground water off overlying land, legislative action was needed to allow public water suppliers to use such ground water by a system of permits granted by the Director of Water Resources. Public water suppliers are defined in § 46-638(2) as cities, villages, natural resource districts, et cetera, supplying water to inhabitants for domestic or municipal purposes. We read Sorensen as changing the common law of Nebraska by loosening the restriction against transfers of ground water off overlying land to the extent allowed by the Municipal and Rural Domestic Ground Water Transfers Permit Act. As a result of the act, a public water provider could transfer ground water via a permit provided for by the act. Thus, as shown by Sorensen, the common law of Nebraska in 1989 prohibited what JoAnn Kuhns and the Springers did by their 1989 purchase agreement and deed because it was a transfer of ground water off overlying land for agricultural purposes. This was not allowable at that time.
In 1995, the Legislature addressed the matter of the transfer of ground water off overlying land by the owner to an adjacent landowner for agricultural use by introducing L.B. 251. As outlined in Sorensen, previous statutory modifications of the common law of Nebraska had allowed transfers of ground water, but only for domestic or municipal purposes. L.B. 251 was introduced to "provide an allowance in State Statute for the transfer of ground water for agricultural purposes." Statement of Purpose, L.B. 251, Committee on Natural Resources, 94th Leg., 1st Sess. (Jan. 27, 1995).
L.B. 251, codified as § 46-691, effective September 9, 1995, provides:
(1) Any person who withdraws ground water for agricultural purposes ... from aquifers located within the State of Nebraska may transfer the use of the ground water off the overlying land if the ground water is put to a reasonable and beneficial use within the State of Nebraska and is used for an agricultural purpose ... after transfer, and if such withdrawal, transfer, and use (a) will not significantly adversely affect any other water user, (b) is consistent with all applicable statutes and rules and regulations, and (c) is in the public interest.
If a proposed intrastate use comes within the purview of the ground water transfer law, § 46-691, the applicable natural resources district is required to conduct an investigation *329 of the withdrawal and transfer of ground water if an affected party objects to the transfer. The natural resources district may also prohibit the transfer if it does not comply with the district's rules and regulations. The district shall request a hearing before the Department of Water Resources if the proposed transfer does not meet the statutory requirements of § 46-691(1). We observe that there is no contention or evidence that the easement and transfer of ground water involved in this case do not meet the four statutory requirements of § 46-691: (1) Other water users are not adversely affected; (2) the transfer is consistent with all statutes, rules, and regulations; (3) the transfer is in the public interest; and (4) the transfer is for a reasonable and beneficial use for agricultural purposes.
Because the 1989 purchase agreement and deed allowed for the transfer of ground water off overlying land before the passage of L.B. 251 and at a time when the common law of Nebraska prohibited such a transfer, we must address the effect that the subsequent enactment of § 46-691 had on the purchase agreement and deed between JoAnn Kuhns and the Springers. It is necessary that we do so because "[i]t is fundamental that a contract for an illegal purpose is void and unenforceable." Central States Health & Life v. Miracle Hills Ltd., 235 Neb. 592, 596, 456 N.W.2d 474, 477 (1990). When the parties are asserting rights founded in an illegal and void contract, the court leaves the parties just where they placed themselves and does not enforce the contract. Id. Whether in law or equity and irrespective of whether the contract is executory or executed, the court will not aid either party to an illegal contract. Northland Transp., Inc. v. McElhose, 3 Neb.App. 650, 529 N.W.2d 809 (1995). However, there appears to be a potential exception when the law changes and what was unlawful becomes lawful.
The Restatement of Contracts § 609 at 1128 (1932) sets forth:
A bargain that is illegal when formed does not become legal
(a) by reason of a change of fact, except where both parties when the bargain was made neither knew nor had reason to know the facts making it illegal, or
(b) by reason of a change of law, except where the Legislature manifests an intention to validate the bargain.
See, Davis v. General Motors Acceptance Corp., 176 Neb. 865, 127 N.W.2d 907 (1964) (citing Restatement, supra, and 6 Williston on Contracts, § 1758 (rev. ed. 1938) in case where Legislature expressly dictated that statute would apply to all transactions made prior to effective date of act, unless action on such transaction had been reduced to final judgment); Curtis v. Securities Acceptance Corp., 166 Neb. 815, 91 N.W.2d 19 (1958) (citing Restatement, supra, but finding no legislative manifestation of intent to retrospectively validate illegal bargains or contracts in cases involving legislative change in civil penalties for usurious contracts).
Because there has been an obvious change of the applicable law after the parties made their agreement, we address the retroactivity issue first. The question is whether the Nebraska Legislature manifested an intent to validate previous agreements to transfer ground water off overlying land with the passage of L.B. 251 or whether this very substantial change in the law of Nebraska intended to operate only prospectively. To ascertain the intent of the Legislature, a court may examine the legislative history of the act in question. Goolsby v. Anderson, 250 Neb. 306, 549 N.W.2d 153 (1996).
The legislative history of L.B. 251 is rather scant. However, while L.B. 251 was in committee, Senator Curt Bromm stated: "I appreciate you bringing the bill because I think there's a great deal of this happening and we should probably be dealing with it ..." to which Senator Janis McKenzie replied, "Right, and I believe ... that many people do transfer water from one area to another currently believing they are in full compliance with the law. They have no ... really no understanding that ... that we do not allow that in state statute." Natural Resources Committee Hearing, L.B. 251, 94th Leg., 1st Sess. 7 (Jan. 27, 1995). From these comments and the statement of purpose previously cited, it is clear that L.B. 251 was intended to be statutory authorization for *330 transfers of ground water off overlying land for agricultural purposes because the common law had prohibited such transfers. Whether the change was to operate retroactively is not so clear. The senators were obviously aware of the existence of such transfers, the common law notwithstanding, but there is no language in the statute or legislative discussion about voiding such preexisting transfers.
The general rule is that a legislative enactment operates only prospectively, unless legislative intent and purpose that it should operate retrospectively are clearly disclosed. Proctor v. Minnesota Mut. Fire & Cas., 248 Neb. 289, 534 N.W.2d 326 (1995). We are to look to the purpose of a statute and give the statute a construction which best achieves its purpose. Solar Motors v. First Nat. Bank of Chadron, 249 Neb. 758, 545 N.W.2d 714 (1996). The fact that the Legislature did not declare that § 46-691 would be retroactive is not determinative. See Nickel v. Saline Cty. Sch. Dist. No. 163, 251 Neb. 762, 559 N.W.2d 480 (1997).
We find two facts very significant: First, the Legislature was operating with the knowledge that such transfers had occurred and were occurring, and second, the senators did not act to attempt to void these prior transfers by adopting statutory language making this very important change in the water law of Nebraska prospective only. Water is the lifeblood of this stateit is water which makes our land productive and our agriculture economically viable. The disruptive economic and legal consequences which would flow from a "prospective only" application of L.B. 251 are easily imagined, although we admit the extent thereof is difficult to discern from the scant legislative history and is not revealed by the record hereexcept in the instant case. Nonetheless, we presume that the Legislature was aware of such potential consequences. Thus, given the Legislature's failure to limit the effect of the legislation to the future only, we believe that the only reasonable construction of the statute is that it was intended to also operate retroactively on existing transfers. Thus, because the Legislature manifested an intention to validate transfers of ground water off overlying land, which is exactly what the agreement between JoAnn Kuhns and the Springers did, the agreement cannot be voided in this litigation because it was contrary to the common law of Nebraska when made by the parties.
Our reasoning is obviously different from that of the district court. Although we reject the trial court's reasoning that this matter is analogous to "mineral rights," we will not reverse the trial court's decision when it is correct, even though the trial court's reasoning is not. See Healy v. Langdon, 245 Neb. 1, 511 N.W.2d 498 (1994).
Inasmuch as the agreement is lawful, we turn to JoAnn Kuhns' final argument that the court erred in granting injunctive relief to the Springers when such relief was neither pled nor prayed for in their petition. JoAnn Kuhns argues that a judgment must be supported by the allegations of the pleading on which it is based, citing State ex rel. Douglas v. Schroeder, 212 Neb. 562, 324 N.W.2d 391 (1982), and that since the Springers' petition prayed for rescission of the deed and, in the alternative, quiet title, the Springers' failure to request an injunction made it improper for the trial court to award one.
A quiet title action and an action for rescission are equitable in nature. See, Schuelke v. Wilson, 250 Neb. 334, 549 N.W.2d 176 (1996); Gustin v. Scheele, 250 Neb. 269, 549 N.W.2d 135 (1996). When a court of equity has obtained jurisdiction of a case for any purpose, it will retain it for all purposes and will proceed to a final determination of the case, adjudicating all matters in issue, thus avoiding unnecessary litigation. Brtek v. Cihal, 245 Neb. 756, 515 N.W.2d 628 (1994). When equity once acquires jurisdiction, it will retain it so as to afford complete relief. Miller v. School Dist. No. 69, 208 Neb. 290, 303 N.W.2d 483 (1981). Even though the petition did not request a permanent injunction, a temporary injunction was sought and granted by the trial court. The petition alleged that JoAnn Kuhns, through her agent, continually threatened to interfere with the Springers' easement rights. The trial court's order, in decreeing, "Defendant and her agents are permanently enjoined *331 from interfering in any way with Plaintiffs' access, use, maintenance or repair ..." addressed an issue litigated before the court and avoided the need for additional litigation in the event JoAnn Kuhns attempted to stop or frustrate the Springers' use of the well. There was no error in granting the injunction.

CONCLUSION
Accordingly, we find that the agreement between JoAnn Kuhns and the Springers to transfer ground water off overlying land for agricultural purposes, although not governed by a specific statute when made, became legal with the subsequent passage of L.B. 251. Furthermore, we find that the trial court's decision to enjoin JoAnn Kuhns and her agents from interfering with the Springers' water rights was well within the court's equity jurisdiction.
AFFIRMED.
