OPINION
PARKER, Judge.Mears Park Development Company (MPDC) appeals from the trial court’s order granting Adolfson and Peterson, Inc. (A & P), partial summary judgment ordering MPDC to pay retainage to A & P in the amount of $127,282.71, along with interest and attorney’s fees. We reverse.
FACTS
The parties entered into an agreed statement of the record which is the basis for the following statement of facts.
A & P performed structural concrete work and certain structural steel work for the Galtier Plaza project pursuant to a series of contracts with MPDC. A & P’s work consisted of pouring all the concrete for the Sibley Tower, the commercial/retail areas, and the Jackson Tower. Sibley Tower was substantially completed on October 9, 1984; the commercial/retail areas were substantially completed on November 10, 1984; the Jackson Tower was substantially completed on June 30, 1985. These construction contracts apparently called for a certain sum or percentage of payments due A & P to be “retained” until the contracts were performed.
A & P intervened in an existing foreclosure action in an attempt to foreclose its own mechanic’s lien. A & P demanded to be paid the retainage being withheld by MPDC on the above three buildings.
MPDC filed an answer and asserted three cross-claims in the foreclosure action. In the third cross-claim, MPDC sought indemnity and contribution for that portion of a claim made by Hayes Contractors, Inc., against MPDC in the amount of $522,-747.54; MPDC contends that at least a portion of the amount claimed by Hayes Contractors was attributable to A & P’s allegedly defective work. The dispute between Hayes Contractors and MPDC had not been finally resolved at the time the trial court entered its order for partial summary judgment.
The parties have stipulated that the third counterclaim shall be the sole subject of this appeal. We apply that stipulation, although the parties have also discussed the first counterclaim in their briefs.
On January 22, 1988, A & P moved for an order dismissing MPDC’s third counterclaim and compelling MPDC to pay A & P partial retainage of $127,282.71, plus interest. A & P arrived at this partial retainage figure using the agreed-upon figure for total retainage on the project of $204,-282.71, less the $77,000 in the second claim.
In its motion for summary judgment, A & P argued that MPDC’s third counterclaim (involving Hayes Contracting) should be dismissed because it was an unmatured obligation, not presently due and owing, and thus could not be used as a setoff against the matured obligation involving A & P retainages, which A & P argued were then due and owing. The trial court granted A & P partial judgment. It denied A & P’s motion to dismiss the third counterclaim, but directed entry of judgment in the amount of $127,282.71 for the retainage A & P claimed was due to it. The trial court also awarded attorney’s fees in the amount of $30,000 and prejudgment interest in the amount of $32,036.62, for a total judgment of $189,319.33.
ISSUES
1. Did genuine issues of material fact exist on the parties’ potential liability in the Hayes Contractors matter, thereby making the trial court’s award of summary judgment erroneous?
2. Did the trial court err as a matter of law in ordering MPDC to pay the retainage to A & P?
*33. Did the trial court err in awarding attorney’s fees and interest?
DISCUSSION
On appeal from a summary judgment, it is the function of this court to determine only (1) whether there are any genuine issues of material fact and (2) whether the trial court erred in its application of the law. Betlach v. Wayzata Condominium, 281 N.W.2d 328, 330 (Minn.1979).
I
The determinative question before this court is whether MPDC owes A & P the retainage absolutely at this time. There is no dispute that the projects were completed; there is, however, a dispute about the quality of the work performed and the liability of A & P for extra costs incurred by MPDC, allegedly as a result of A & P’s inadequate performance. Hayes Contractors claims that there were problems with concrete elevations varying from floor to floor in all areas of the commercial area, rental offices, Sibley Tower, Jackson Tower, and Parkside Condos. Because A & P poured the concrete for these structures, MPDC asserts that it has potential future claims against A & P.
In Knutson v. Lasher, 219 Minn. 594, 18 N.W.2d 688 (1945), the Minnesota Supreme Court held that whether a contractor has substantially performed its obligations and the amount of damages occasioned by omissions and defects are fact questions. Id. at 603, 18 N.W.2d at 694. The trial court, however, did not find that the factual dispute involving Hayes Contractors and the parties to this suit should preclude it from granting partial summary judgment. The trial court held that it “cannot set off * * * these esoteric, unmatured obligations at this time against retainage which it owes absolutely.” This court holds, however, that there were material factual disputes involving the potential future liability of A & P in the Hayes Contractors matter; the record before the trial court contained unresolved factual questions on the varying floor elevations and the effect these had on the work done by Hayes Contractors. Resolution of these factual issues will determine whether MPDC will have a matured claim to set off against (or deduct from) the retainage. Summary judgment was therefore premature.
II
The legal question at issue involves the application of the term “retainage” in a construction law context. Based on a reading of the trial court’s order and memorandum and the parties’ arguments, there appears to be a dispute on whether retainage is to be kept only until completion of the project, or whether it has a broader meaning encompassing actual quality of performance and approval of the work by the owner or its agents.
There is a real paucity of case law in Minnesota defining or discussing retainage. The cases indicate that it is generally defined by the terms of the contract which provide for retention by the owner of a percentage of the contractor’s current earnings. See, e.g., Graves v. Merrill, 67 Minn. 463, 70 N.W. 562 (1897); Milavetz v. Oberg, 138 Minn. 215, 164 N.W. 910 (1917).
Although the trial court discussed the existence of performance bonds among the reasons for its decision, copies of these bonds or their terms were not found in the trial court record. Neither the trial court nor the parties discuss the retainage terms which presumably were contained in the contract, and the trial court record does not contain a copy of the contract entered into by MPDC and A & P. Thus, in searching for a definition of retainage, this court turns to secondary sources.
In Justin Sweet, Legal Aspects of Architecture, Engineering and the Construction Process (2d ed. 1977), retainage is defined as
a contractually created security system under which the owner retains a specified portion of earned progress payments to secure itself against certain risks. For example, suppose the schedule of values establishes that the contractor is entitled to a progress payment of $50,-000. Commonly construction contracts provide that a portion of this $50,000 will *4be retained by the owner and paid at the end of the project or at some later date. The purpose of retainage is to provide money out of which claims the owner has against the contractor can be collected without the necessity of a lawsuit. It is not an agreed damage or damage limit.
Id. at 428 (emphasis added). In J. Stewart Stein, Construction Glossary (1980), re-tainage is defined as a sum withheld from each payment to the contractor in accordance with the terms of the owner-contractor agreement. Id. at 622.
We hold that the trial court erred as a matter of law in ordering the return of A & P’s retainage at this time. Since a purpose of retainage is to secure a fund of money from which claims of the owner against the contractor can be collected without the necessity of a lawsuit, this fund must continue to exist for payment of potential claims MPDC may have against A & P as a result of its lawsuit with Hayes Contractors.
Retainage is a security device and the issue here is possession of that security fund. The trial court correctly stated that “esoteric, unmatured obligations” cannot be set off against retainage which is owed absolutely. The trial court’s analysis of MPDC’s position in terms of setoff, however, ignores the basic notion of retainage as a security device to hold a fund of money available for payment of sums due upon determination of liability on the counterclaim. The as-yet undetermined liability of A & P is a genuine issue of material fact which forecloses an order for payment of the retainage at this time. If MPDC prevails in the matter involving Hayes Contractors, the retainage must then be paid to A & P. Thus, it was premature for the trial court to order that the retainage be paid at this time, and the award of partial summary judgment is reversed.
Ill
The trial court awarded A & P attorney’s fees and prejudgment interest. We find that based on our analysis above, these awards are premature at this time and should also be reversed.
DECISION
REVERSED.