
    Submitted on briefs June 8,
    affirmed July 20, 1977
    KOZOL et ux, Respondents, v. SEREAN, Appellant.
    
    (TC 75-1895-L-3, SC 24716)
    566 P2d 901
    
      Thomas C. Howser, of Cottle & Howser, Ashland, filed a brief for appellant.
    Jack Davis, of Davis, Ainsworth & Pinnock, Ash-land, filed a brief for respondents. !
    Affirmed.
   PER CURIAM.

This is an action for damages for breach of a contract for construction by defendant of a house for plaintiffs. Defendant’s answer alleged as an affirmative defense that he had been adjudicated bankrupt in the federal district court; that plaintiffs had actual knowledge of the bankruptcy filing; that the "discharge will include the claim of the plaintiffs” and is a "bar” to that claim; and that defendant "should be awarded an attorney fee of $1,750 pursuant to ORS 20.094.” Plaintiffs’ reply denied "every allegation” in defendant’s answer.

The plaintiffs filed a motion for voluntary nonsuit. The trial court initially denied that motion. That motion was renewed, however, at the beginning of a hearing on defendant’s affirmative defense of bankruptcy. At that time the court granted plaintiffs’ motion for nonsuit and awarded defendant his statutory costs, excluding attorney fees.

Defendant appealed to this court contending that the trial court "erred in granting Plaintiffs’ motion for voluntary nonsuit, when there was a pending claim for attorneys’ fees by Defendant and in refusing to determine if Defendant was the prevailing party and on what grounds.”

Defendant concedes in his brief that the trial court "had the authority,” under ORS 18.230, to enter a judgment of nonsuit on plaintiffs’ complaint. Defendant contends, however, that because this "also terminated defendant’s affirmative request for attorney fees in the event defendant prevailed on the ground of discharge in bankruptcy, pursuant to ORS 20.094” (emphasis added) and because "there was and is no substantial question that defendant would have prevailed,” it follows that "the Court should have continued plaintiffs as a party to defendant’s request for attorney fees” and that "the Court’s ruling allowed Plaintiffs to avoid liability for fees resulting from their action in instigating this suit in the first place.”

We disagree. Plaintiffs’ liability to defendánt for attorney fees in this case was not based upon their action in "instigating this suit in the first place.” This was not an action on a contract containing a provision for attorney fees to the "prevailing party.” Instead, plaintiffs’ liability for attorney fees depended upon whether defendant could prove his affirmative defense of a discharge in bankruptcy, which plaintiffs had denied. In the absence of a trial which included that defense we cannot properly assume that there was "no substantial question that defendant would have prevailed.” i

Under the provisions of ORS 18.230 the trial court had the power, in the exercise of its discretion, tq grant plaintiffs’ motion for voluntary nonsuit despite the filing of that affirmative defense, which, in effect, was not only an affirmative defense, but a counterclaim for attorney fees. The trial court, in the exercise of its discretion, might have denied the granting of the nonsuit and proceeded with the hearing on defendant’s affirmative defense, but under the terms of ORS 18.230(1) it was not required to do so. It followjs that the resulting judgment of the nonsuit terminated the pending affirmative defense of discharge in bankruptcy. This included defendant’s demand for attorney fees, which depended upon proof of that defense.

Plaintiffs cite our recent decision in Slocum v. Harder, 275 Or 725, 553 P2d 349 (1976), as requiring a contrary result. In that case, however, defendant’s claim for attorney fees did not depend upon proof of an affirmative defense or counterclaim, as in this case. Instead, the contract which plaintiff sought to foreclose in that case contained a provision that in the event suit or action were instituted by any of the parties to the contract to enforce it, the prevailing party would be entitled to attorney fees. Thus, the defendant in that case was entitled to attorney fees under the terms of that contract if the defendant was the "prevailing party” in the original action filed by the plaintiff.

In this case, however, defendant does not claim attorney fees under such a contract provision, but under the terms of ORS 20.094. That statute provides for an award of attorney fees "if the defendant prevails on the ground of bankruptcy.” Although defendant alleged bankruptcy as an affirmative defense, those allegations were denied and there was no trial on that issue. Thus, the defendant did not prevail in this case "on the grounds of discharge in bankruptcy.” For reasons previously stated, the trial court had power, in its discretion, to grant plaintiffs’ motion for voluntary nonsuit and to decline to proceed with a trial on that, or any other, issue in this case.

The judgment of the trial court is affirmed. 
      
      ORS 20.094 provides:
      "In any action or suit on a debt, the court shall award the debtor who is a defendant a reasonable attorney fee, in addition to disbursements, if the defendant prevails on the grounds of discharge in bankruptcy.”
     
      
      ORS 18.230 provides:
      "(1) A judgment of nonsuit may be given:
      "(a) As a matter of right, on motion of the plaintiff filed with the court and served on the defendant not less than five days prior to the day of trial if no counterclaim has been pleaded; if a counterclaim has been pleaded or if it is less than five days prior to the day of trial, the allowance of the motion shall be subject to the discretion of the court.
      * * * * »
     