
425 So.2d 573 (1982)
CASTLE CONSTRUCTION COMPANY D/B/a Alabama Castle Construction Company, Inc., Appellant,
v.
HUTTIG SASH & DOOR COMPANY, Longardner & Associates of Florida, Inc., Fort Myers Roofing Company, and J. Foster Pate, Appellees.
No. 81-2488.
District Court of Appeal of Florida, Second District.
December 15, 1982.
Rehearing Denied January 21, 1983.
*574 Gerald W. Pierce of Henderson, Franklin, Starnes & Holt, Fort Myers, for appellant.
Dwight A. Whigham of Bigelow & Winesett, Fort Myers, for appellees Fort Myers Roofing Co. and J. Foster Pate.
SCHEB, Acting Chief Judge.
Appellant Castle Construction Company contends the trial court erred in (1) denying its third-party claim for indemnity while still holding it responsible for the damages resulting from the negligence of its subcontractor, Fort Myers Roofing Company, and (2) entering a partial summary judgment limiting the liability of J. Foster Pate as personal guarantor of its subcontractor's performance. We agree with appellant's first contention; we reject the second.
Castle, a general contractor, constructed a building for Huttig Sash & Door Company. It subcontracted the roofing to Fort Myers Roofing Company. After construction was completed in the latter part of 1974, the roof started leaking. In November 1978 Huttig, the owner, sued Castle to recover damages. In January 1979 Castle joined Fort Myers Roofing and Pate, guarantor of the subcontractor's performance, as third-party defendants. Castle sought indemnity against its roofing subcontractor alleging that Fort Myers Roofing was solely responsible for the negligent construction of the roof.
The trial court entered judgment against Castle for $255,791.28 for the damages Huttig would incur in replacing the roof, but denied Castle's claim for indemnity against the third-party defendants. Prior to denying Castle's claim for indemnity, the trial court, by partial summary judgment, had limited Castle's recovery against the guarantor to $88,400. This appeal ensued.
In denying Castle's claim for indemnity, the trial court did not articulate any reasons for its decision. Although Fort Myers Roofing and Pate asserted several affirmative defenses in the trial court, on appeal the parties have focused their arguments principally on whether the statute of limitations barred Castle's action for indemnity. We perceive this to be the only issue which merits discussion on the right to indemnity.
Castle argues that the statute of limitations for its indemnity action could not commence until its liability had been determined. Fort Myers Roofing and Pate, on the other hand, argue that the defect in the roof was not latent and, therefore, the statute of limitations began running when construction was completed in the latter part of 1974. They concede that the evidence did not establish that the four-year limit in section 95.11(3)(c), Florida Statutes, had run prior to Huttig's suit against Castle. Yet, they contend that the four years ended in 1978, thus barring any claim by Castle for indemnity since Castle did not file its third-party action until January 1979.
The right of indemnity is based on principles of equity and inures to one who discharges a duty owed by him, but which, as between himself and another, should have been discharged by the latter. Indemnity is allowed only where the indemnitor is solely at fault. It thereby shifts the entire loss from one who, although without active negligence or fault, has been obligated to pay, because of some vicarious or constructive liability, to another who should bear the costs because it was the latter's wrongdoing. Houdaille Industries, Inc. v. Edwards, *575 374 So.2d 490 (Fla. 1979). The statute of limitations for an action seeking indemnity does not begin running until the litigation against the third-party plaintiff has ended or the liability, if any, has been settled or discharged by payment. Mims Crane Service, Inc. v. Insley Manufacturing Corp., 226 So.2d 836 (Fla.2d DCA), cert. denied, 234 So.2d 122 (Fla. 1969); Employers' Fire Insurance Co. v. Continental Insurance Co., 326 So.2d 177 (Fla. 1976).
Castle's third-party action against Fort Myers Roofing and Pate was filed prior to Huttig obtaining judgment against Castle. Since the litigation against Castle had not ended and there was no discharge or payment of any liability, Castle's claim for indemnity could not be barred by the statute of limitations. Therefore, Castle is entitled to indemnity if it was without fault.
Fort Myers Roofing and Pate suggest alternatively that the trial court's ruling may be upheld on any of the theories advanced by other affirmative defenses they asserted in an amended pleading. However, we have reviewed these arguments and find no merit to them.
As noted, Castle also challenges entry of the partial summary judgment in favor of Pate. Castle's contract with Fort Myers Roofing originally required its subcontractor to post a performance and payment surety bond in the penal sum of $88,400. Subsequently, Castle agreed to accept Pate's personal guaranty in lieu of the surety bond. Pate delivered his personal guaranty in which he referred to the principal contract. The trial court construed the guaranty as having been accepted in lieu of the surety bond and subject to the same penal liability although on its face it appeared unlimited. There was no indication in the documents that Castle sought any greater security from Pate, or that Pate intended to give greater security than called for by the contract. It was appropriate for the court to construe the contract and guaranty together. Collins v. National Fire Insurance Co., 105 So.2d 190 (Fla. 2d DCA 1958).
Where, as here, the determination of a party's liability depends on the written instruments of the parties and their legal effect, the question becomes one of law only and is determinable by summary judgment. Kochan v. American Fire and Casualty Co., 200 So.2d 213 (Fla. 2d DCA), cert. denied, 204 So.2d 329 (Fla. 1967). Therefore, we see no error in the court's judgment limiting Pate's potential liability to $88,400.
Accordingly, we affirm the partial summary judgment entered in favor of Pate, but reverse the amended final judgment to the extent that it denied Castle's claim for indemnity against the third-party defendants. We remand for further proceedings consistent with this opinion.
CAMPBELL and SCHOONOVER, JJ., concur.
