
888 S.W.2d 306 (1994)
318 Ark. 848
Richard Earl GRIFFIN, Appellant,
v.
FIRST NATIONAL BANK OF CROSSETT, Appellee.
No. 93-01302.
Supreme Court of Arkansas.
December 5, 1994.
*308 Hopkins & James, Little Rock, for appellant.
Gregory M. Hopkins, Patrick R. James, Little Rock, for appellee.
ROBERT SHULTS, Special Chief Justice.
On May 1, 1986, First National Bank of Crossett (the "Bank") loaned Bearhouse, Inc. ("Bearhouse") $490,000 and took a promissory note as evidence of the debt. Payment of the note was secured by a mortgage on real estate. In connection with the loan, Richard Earl Griffin ("Griffin") executed a guaranty "limited to 25% of the outstanding debt" plus "all expenses, legal and/or otherwise (including court costs and attorney's fees, paid or incurred by said Bank in endeavoring to collect such indebtedness, obligations and liabilities, or any part thereof, and in enforcing this guaranty)."
Bearhouse defaulted on its note and was placed in involuntary bankruptcy. In the bankruptcy proceeding, the trustee in bankruptcy challenged the validity of the Bank's mortgage securing payment of the note. In the meantime, the Bank had sued Griffin on his guaranty and Griffin answered alleging that the Bank had impaired the collateral for the Bearhouse loan because the mortgage securing the loan was not valid and the Bank had failed to realize on its collateral in a commercially reasonable manner, thereby releasing Griffin of liability on his guaranty. Griffin also filed a counterclaim alleging misrepresentation, negligence, and breach of fiduciary duty. All of the counts in the counterclaim were based on the Bank's alleged failure to obtain a valid mortgage on the real estate securing the Bearhouse loan. Subsequently, the Bankruptcy Court found that the Bank's mortgage was in fact valid.
Thereafter, the case between the Bank and Griffin was tried to the court without a jury on February 13, 1990. Griffin was allowed to testify, over the objection of the Bank, that he had discussions with an officer of the Bank prior to execution of his guaranty in which he agreed to guarantee only 25% of any deficiency in the debt to the Bank after credit for the amount the Bank realized from sale of the mortgaged real estate. He also testified that the value of the real estate was such at the time of the Bearhouse bankruptcy that, if it had been sold at that time, 25% of the resulting deficiency would have been $17,000. The trial court accepted Griffin's arguments and entered judgment in favor of the Bank for $17,000. The Bank appealed from that judgment, and this Court reversed and remanded the case to the Ashley County Circuit Court. First National Bank v. Griffin, 310 Ark. 164, 832 S.W.2d 816 (1992), cert. denied, ___ U.S. ___, 113 S.Ct. 1280, 122 L.Ed.2d 673 (1993).
In the above opinion, this Court held that Griffin's guaranty agreement was clear and unambiguous and that parol evidence should not have been admitted to vary it. Consequently, judgment should have been entered against Griffin for 25% of the outstanding Bearhouse debt and not 25% of the deficiency. This Court also held in that opinion that the defense of impairment of collateral was not available to Griffin under the terms of his guaranty.
*309 In the first appeal of this case, the Bank had also appealed from the refusal of the trial court to award the Bank appropriate attorney's fees. In First National Bank v. Griffin cited above, this Court reversed and remanded the case for a new trial and directed the trial court to "award an appropriate attorney's fee pursuant to the agreement of the parties." Id., 310 Ark. at 174, 832 S.W.2d at 821.
After the case was remanded to the Ashley County Circuit Court, the Bank filed a motion for partial summary judgment with accompanying affidavits setting out the amount of the outstanding debt to the Bank on the Bearhouse loan. Griffin responded by arguing that he should be able to have a trial on his counterclaim after the case had been remanded. The trial court (Hon. Samuel H. Bird, Circuit Judge on Assignment) rejected Griffin's argument, holding that this Court in the first appeal of this case had decided all issues related to the Bank's suit against Griffin on his guaranty adversely to Griffin. The trial court held Griffin was barred by res judicata from trying his counterclaim after the case had been remanded and consequently granted the Bank a partial summary judgment against Griffin in the amount of 25% of the outstanding Bearhouse debt.
It is from this partial summary judgment that Griffin brings this appeal which is now before this Court.
After the trial court granted the partial summary judgment in favor of the Bank, there remained the issue of attorney's fees to be awarded to the Bank. A hearing was held to determine the appropriate amount of such fees. The trial court concluded that the amount of the fees should conform to the agreement of the parties to the extent not prohibited by law. The trial court grouped services rendered by the Bank's attorney in the following categories.
1. Services in U.S. Bankruptcy Court proceedings against Bearhouse.
2. Services in the trial court against Griffin.
3. Services in appellate court against Griffin.
4. Services to be rendered in trial and appellate courts in the future in the collection of the judgment against Griffin.
The trial court determined that reasonable attorney's fees and expenses chargeable to Griffin for services rendered in the trial court were $24,994.56 and awarded the Bank a judgment against Griffin in that amount. In making this determination, the trial court held that it had no authority to award fees for services rendered in the Bankruptcy Court or in the appellate court, or for services to be rendered in the future. The Bank cross-appealed asking for reversal of the trial court's decision disallowing attorney's fees for services in the Bankruptcy Court and in the appellate court.

APPEAL
In his appeal, Griffin contends that after the case was remanded by this Court in the first appeal, the trial court erred in not granting him a trial on his counterclaim. That counterclaim had been filed and was pending when the trial court entered its judgment in the first trial of this case awarding the Bank $17,000. The court did not enter any finding on Griffin's counterclaim and no cross-appeal was taken by Griffin on the court's failure to do so.
In a well reasoned opinion by Judge Bird, after the case had been remanded, he held that res judicata barred Griffin from litigating his counterclaim. That decision was correct.
In Bailey v. Harris Brake Fire Protection District, 287 Ark. 268, 269, 697 S.W.2d 916, 917 (1985), the Court said:
Our decision in this case is based upon the well established law of the claim preclusion facet of res judicata. It bars relitigation of a subsequent suit when: (1) the first suit resulted in a final judgment on the merits; (2) the first suit was based upon proper jurisdiction; (3) the first suit was fully contested in good faith; (4) both suits involve the same claim or cause of action; and (5) both suits involve the same parties or their privies.
*310 In the first trial of this case before the Ashley County Circuit Court, all matters relating to Griffin's counterclaim were fully contested in good faith. The court entered judgment in favor of the Bank without making any reference to the counterclaim. This was tantamount to denial of the counterclaim, and, when no cross-appeal was taken in regard to the counterclaim, this had the effect of a final judgment denying it. We note that what constitutes a final judgment for res judicata purposes is not necessarily the same as what constitutes a final judgment for other purposes. See Restatement (Second) of Judgments § 13 (1982). Accordingly, all factors making res judicata applicable in this case are present.
The clearly established Arkansas law regarding res judicata is also set out in Wells v. Arkansas Public Service Commission, 272 Ark. 481, 483, 616 S.W.2d 718, 719 (1981):
We first consider the question of res judicata and when it is applied. Generally speaking, it applies when there has been a final adjudication on the merits of an issue, without fraud or collusion, by a court of competent jurisdiction, on the matters litigated or which might have been litigated.... It is res judicata even though not adjudicated if the matters were necessarily within the issues and might have been litigated in the former suit.
In this case, the issues raised in Griffin's counterclaim were clearly within the issues involved in the first trial and the first appeal of this case. By not asking the trial court to rule explicitly on his counterclaim in the first trial and failing to raise that issue in the first appeal of this case, Griffin was barred by res judicata from having a trial on his counterclaim when the case was remanded to the Ashley County Circuit Court.
We also hold that Griffin was barred from having a trial on his counterclaim after the case was remanded by the doctrine of law of the case. Mercantile First National Bank v. Lee 31 Ark.App. 169, 790 S.W.2d 916 (1990), involved an issue similar to the one in this case. There the Court stated:
"On second appeal, as in this case, the decision of the first appeal becomes the law of the case, and is conclusive of every question of law or fact decided in the former appeal, and also of those which might have been, but were not, presented."
Id., 31 Ark.App. at 173, 790 S.W.2d at 919 (citations omitted).
Griffin's counterclaim was based solely on the allegation that he was entitled to a judgment against the Bank because of alleged impairment of collateral in failing to obtain from Bearhouse a valid mortgage on real estate. The question of impairment of collateral was before this Court in the first appeal of this case, and any question of fact or law on that issue either was or might have been presented to this Court at that time. Accordingly, this Court's decision in the first appeal in this case regarding Griffin's allegation concerning impairment of collateral was adverse to Griffin and became the law of the case and bars any further consideration of Griffin's counterclaim.
For all of the above reasons, Griffin's appeal is denied and the partial summary judgment entered by the Ashley County Circuit Court in favor of the Bank is affirmed.

CROSS-APPEAL
The Bank takes the position in its cross-appeal that the trial court erred in failing to award the Bank attorney's fees for services rendered in the Bearhouse bankruptcy litigation and for services and expenses incurred in the two appeals to this Court. For reasons set out below, we hold that the Bank is correct.
Griffin specifically agreed in his guaranty "to pay all expenses, legal and/or otherwise (including court costs and attorney's fees, paid or incurred by said Bank in endeavoring to collect such indebtedness, obligations and liabilities, or any part thereof, and in enforcing this guaranty)."
In the first appeal of this case, this Court stated:
Upon remand, the trial court should award an appropriate attorney's fee pursuant to the agreement of the parties.
First National Bank v. Griffin, supra, 310 Ark. at 174, 832 S.W.2d at 821.
*311 The agreement between the Bank and Griffin obligated him to pay all expenses and attorney's fees in connection with collection of the Bearhouse debt and enforcement of Griffin's guaranty. If the agreement is given effect, it includes attorney's fees and expenses in the Bearhouse bankruptcy, the first appeal of this case, the petition for certiorari to the United States Supreme Court, and the present appeal to this Court.
When the trial court addressed the question of appropriate attorney's fees to be awarded the Bank, Judge Bird held that Ark.Code Ann. § 16-22-308 (1994) was the basis on which he had to determine an award of fees in this case. That statute authorizes a court to award attorney's fees in an action to enforce a contract and the trial court correctly found that the action to enforce Griffin's guaranty was covered by that statute. Having made that finding, the trial court then held that, under that statute, attorney's fees could be awarded only for services rendered in the trial court. The trial court based this constraint on holdings of this Court in 215 Club v. Devore, 311 Ark. 309, 843 S.W.2d 317 (1992), and Mosley Machinery Company, Inc. v. Gray Supply Company, 310 Ark. 448, 837 S.W.2d 462 (1992).
Those cases, however, did not involve written agreements specifically providing for the payment of attorney's fees. They do not control the award of attorney's fees in this case, since such an award need not depend on Ark.Code Ann. § 16-22-308 (1994). Here Griffin agreed with the Bank to pay all of the Bank's attorney's fees and expenses incurred by the Bank in collecting the Bearhouse debt and in enforcing Griffin's guaranty. We hold now such an agreement is enforceable in accordance with its terms. This is independent of the statutory authorization providing for attorney's fees under the circumstances covered by Ark.Code Ann. § 16-22-308 (1994). See Damron v. University Estates, Phase II, Inc., 295 Ark. 533, 750 S.W.2d 402 (1988).
It should be noted that Justice Glaze dissented in the Damron case. He pointed out that the opinion in that case allowed parties to enter into private agreements under which they could agree to the award of attorney's fees and expenses even though no statute specifically provided for such an award. He then stated:
If this court now adheres to the rule that parties, by agreement or bylaws, may authorize attorneys' fees as costs or expenses, we should plainly adopt that view.
Id., 295 Ark. at 540, 750 S.W.2d at 406.
Justice Glaze correctly pointed out the need to give parties, attorneys, and judges a clear statement of the law regarding the award of attorney's fees when parties enter into agreements such as the one between the Bank and Griffin. The holding of this Court herein is intended to do so.
Implicit in our holding is a requirement that any attorney's fees awarded should be reasonable. There are established principles which a court should use in determining the reasonableness of an attorney's fee and, among others, these should include consideration of whether or not the actions taken by a party seeking such fees were meritorious and successful. In this and similar cases, determination of what are reasonable fees should be made by the trial court.
In this case, the trial court has made a careful analysis of the reasonable fees allowable to the Bank for legal services and expenses incurred by the Bank in the trial court. That determination governs that award.
We find the Bank's actions in the Bearhouse bankruptcy litigation, in the first appeal of this case to this Court, in the petition for certiorari to the United States Supreme Court, and in this second appeal of this case to this Court to have been meritorious and successful. We, therefore, remand this case to the trial court with directions that the trial court also award to the Bank reasonable attorney's fees and expenses incurred by the Bank in the Bearhouse bankruptcy litigation, in the first appeal of this case to this Court, in the petition for certiorari to the United States Supreme Court, and in this second appeal of this case to this Court.
HOLT, C.J., and DUDLEY, GLAZE and BROWN, JJ., not participating.
*312 W.S. MILLER, Special Justice, joins in this opinion.
JERRY PINSON, Special Justice, concurs.
