
640 A.2d 1065 (1994)
Kevin GLYNN, et al.
v.
CITY OF SOUTH PORTLAND, et al.
Supreme Judicial Court of Maine.
Submitted on Briefs March 4, 1994.
Decided April 22, 1994.
*1066 Francis M. Jackson, Portland, for plaintiffs.
Robert F. Hanson, James D. Poliquin, Norman, Hanson & DeTroy, Portland, for defendants.
Before WATHEN, C.J., and ROBERTS, GLASSMAN, COLLINS,[*] RUDMAN and DANA, JJ.
GLASSMAN, Justice.
Kevin Glynn, a member of the South Portland City Council, and Julie Conroy, a member of the South Portland School Board, appeal from a judgment against them entered in the Superior Court (Cumberland County, Mills, J.). They challenge the denial of their motion to file a second amended complaint against the City of South Portland, the city clerk, the city corporation counsel, and a city ward clerk, alleging an appearance of violations of certain provisions of 21-A M.R.S.A. §§ 601-861 (1993 & Supp.1993) governing the conduct of elections and seeking a judgment declaring which provisions of the state election law governed the defendants' conduct of the June 9, 1992 primary election. The defendants cross-appeal, challenging the court's (Perkins, J.) denial of their request for attorney fees. We affirm the judgment.
By their first amended complaint filed on October 6, 1992, the plaintiffs sought preliminary injunctive relief as to the November 3, 1992 election, permanent injunctive relief with respect to all following elections, and damages for the defendants' alleged failure to comply with eight specific provisions of the state election laws set forth in Title 21-A of the Maine Revised Statutes. In addition, they sought their attorney fees and costs pursuant to 5 M.R.S.A. §§ 4682-4683 (Supp. 1993) for an alleged violation of their constitutional rights. After a hearing, on October 29, 1992 the court (Brennan, J.) denied the plaintiffs' motion for a temporary restraining order. Following the November 3 election, the plaintiffs, pursuant to M.R.Civ.P. 15(a), moved for leave of the court to file a second amended complaint in which they abandoned all claims for injunctive relief and damages asserted for constitutional violations and substituted a new claim alleging that "it appeared that several violations had occurred" by the defendants' conduct and seeking a declaratory judgment determining "what provisions of State election law apply to the conduct of elections by the Defendants." After a hearing, the court (Perkins, J.) granted the defendants' motion for a summary judgment on the plaintiffs' first amended complaint on January 8, 1993. Thereafter, following a subsequent hearing, the court (Mills, J.) issued its order on April 8, 1993 denying the plaintiffs' motion to file a second amended complaint on the ground that it failed to state a claim for relief. At a hearing on April 30, 1993, the court (Perkins, J.) denied the defendants' request for attorney fees but granted their request for costs in the amount of $4,559.04.
We note first that the plaintiffs filed their motion for leave to file a second amended *1067 complaint prior to the court's hearing on the defendants' motion for a summary judgment. The motion for leave to amend remained pendent after the entry of the summary judgment for the defendants. Thus, the summary judgment was not a final judgment that "fully decide[d] and dispose[d] of the whole matter leaving nothing further for the consideration and judgment of the trial court." Ford New Holland, Inc. v. Thompson Machine, Inc., 617 A.2d 540, 541 (Me. 1992). Considerations of finality and judicial economy suggest that the better practice would have been for the trial court to dispose of the pending Rule 15(a) motion prior to granting the defendants a summary judgment on the first amended complaint.
The plaintiffs contend that the trial court erred when it denied them leave to amend their complaint on the ground that their second amended complaint "fail[ed] to state a claim for relief." We need not address the defendants' argument that the plaintiffs lacked standing to maintain the second amended complaint because we agree with their contention that the proposed amended complaint does not present an existing controversy, and accordingly, the trial court properly denied the plaintiffs' motion. See District Attorney v. City of Brewer, 543 A.2d 837, 839 (Me.1988) (complaint for declaratory relief inappropriate if purpose is to obtain declaration that certain past conduct was or was not violative of particular state law). Here, the proposed amended complaint states that it "appeared several violations had occurred." A declaratory judgment that such a hypothesis is valid would clearly be an advisory opinion.
A Rule 15 motion for leave to amend is committed to the sound discretion of the trial court. One seeking to overturn such a determination on appeal "must demonstrate a clear and manifest abuse of that discretion and must demonstrate that granting such motion is necessary to prevent injustice." Bangor Motor Co. v. Chapman, 452 A.2d 389, 392 (Me.1982). Rule 15(a) provides that leave to file an amended complaint "shall be freely given when justice so requires." The rule is identical to its federal counterpart, Fed.R.Civ.P. 15(a). It is well established in federal law that when, as here, a proposed amended complaint would be subject to a motion to dismiss, the court is well within its discretion in denying leave to amend. See, e.g., Correa-Martinez v. Arrillaga-Belendez, 903 F.2d 49, 59 (1st Cir.1990). The federal principle is a sound one, and we conclude that in the instant case there was no abuse of discretion in the trial court's denial of the plaintiffs' motion for leave to file an amended complaint.
By their cross-appeal, the defendants challenge the court's denial of their request for attorney fees, pursuant to the Maine Civil Rights Act, 5 M.R.S.A. § 4683 (Supp.1993), as the prevailing party. Section 4683 provides that the court may, in its discretion, award reasonable attorney fees and costs to a prevailing party other than the State. The points raised by the defendants in their cross-appeal are the same as those considered and rejected by the trial court. Our review of the record discloses that the court did not abuse its discretion in denying the defendants' request for their attorney fees.
The entry is:
Judgment affirmed.
All concurring.
NOTES
[*]  Collins, J., sat at oral argument and participated in the initial conference but retired before this opinion was adopted.
