After a lengthy criminal trial, petitioner, a minor, was acquitted of all charges in an eight count indictment which included seven counts of sexual battery and one count of lewd and lascivious assault on three separate minors. He filed a motion to tax costs in the trial court pursuant to section 939.06, Florida Statutes (1991), seeking costs in the amount of $692,822.50. After a hearing, the trial court denied the motion, refusing to certify the costs until it had determined “whether or not the costs incurred were reasonable and necessary for the proper defense of the former defendant.” Petitioner now seeks a writ of mandamus from this court requiring the trial court to certify that the costs had been paid. For the following reasons we grant the petition and issue the writ.
Section 939.06, Florida Statutes provides: No defendant in a criminal prosecution who is acquitted or discharged shall be liable for any costs or fees of the court or any ministerial office, or for any charge of subsistence while detained in custody. If he shall have paid any taxable costs in the case, the clerk or judge shall give him a certificate of the payment of such costs, with the items thereof, which, when audited and approved according to law, shall be refunded to him by the county.
The Legislature has thus set forth the proper procedure for an acquitted or discharged defendant to obtain reimbursement for costs expended in his criminal defense and trial. As stated in Clark v. State, 570 So.2d 408 (Fla. 2d DCA 1990):
The statute [section 939.06] mandates that the defendants must either have the court or the clerk of the court certify that the defendants have paid taxable costs in their defense before their case is discharged. Then the defendants should present such certification to the county pursuant to section 939.08, Florida Statutes (1989), for reimbursement.
If the county refuses to reimburse the costs, the defendants could file a civil suit against the county for a determination of reimbursable costs. “The appropriateness of reimbursement for any particular item is not truly put in issue until the county commission denies payment and a civil suit is brought....” Orange County v. Davis, 414 So.2d 278, 280 (Fla. 5th DCA 1982). If the trial court, during the course of the action against the county, rules that the costs are not reimbursable, the defendants can then appeal that decision.
Id. at 410 (footnote omitted); see also Sawyer v. State, 570 So.2d 410 (Fla. 2d DCA 1990); Pfeifer v. Powell, 498 So.2d 614, 615 (Fla. 5th DCA 1986).
In the instant case, petitioner presented the trial court with invoices and corresponding cancelled checks for each item listed in his motion for certification of costs. Thereafter, the court’s only remaining function was to ministerially certify that the costs had been paid. Pfeifer, 498 So.2d at 615; Orange County v. Davis, 414 So.2d 278, 280 (Fla. 5th DCA 1982). When it refused to certify the costs until it had determined “whether or not the costs incurred were reasonable and necessary for the proper defense of the former defendant,” the court erroneously allowed discretion to play a part in the ministerial function of certifying costs.
*674Accordingly, the order under review is reversed, the petition for writ of mandamus is granted, and the trial court is directed to certify that the costs were paid.1
. It is necessary to point out that many of the acts for which petitioner was indicted were alleged to have occurred at the Old Cutler Presbyterian Church where petitioner had been employed as a child care worker. It is undisputed that Church Mutual Insurance Company, the Church’s insurance company, paid all the costs associated with petitioner’s criminal defense and trial even though under the insurance contract it was responsible only for civil claims against the Church. However, if and when the county refunds the money to petitioner, Church Mutual may seek reimbursement from petitioner under the doctrine of equitable subrogation. Although the doctrine does not apply to mere volunteers, Boley v. Daniel, 72 Fla. 121, 72 So. 644 (1916), it will arise when a party discharges an obligation to protect an interest in, or right to, property. Eastern Nat'l Bank v. Glendale Fed. Savs. and Loan Ass’n, 508 So.2d 1323, 1324 (Fla. 3d DCA 1987); see abo Goodwin v. Schmidt, 149 Fla. 85, 5 So.2d 64 (1941) (party not entitled to subrogation if paying without obligation, as mere volunteer); Earle v. Southeast Bank, 590 So.2d 1072 (Fla. 2d DCA 1991), review denied, 599 So.2d 658 (FIa.1992); Photomagic Inds., Inc. v. Broward Bank, 526 So.2d 136 (Fla. 3d DCA), review dbmbsed, 534 So.2d 400 (Fla.1988). In the instant case, Church Mutual paid for petitioner’s defense in the criminal trial in light of the very real interest it had in protecting itself from the civil claims which were inevitably to follow the criminal trial. As a result, Church Mutual is entitled to subrogation from petitioner.