
991 So.2d 253 (2008)
Dennis POSEY
v.
Ernest L. MOLLOHAN.
2060500.
Court of Civil Appeals of Alabama.
March 21, 2008.
*254 Mark A. Dutton, Moulton, for appellant.
James Tassin of James Tassin & Associates, LLC, Tuscumbia, for appellee.
THOMAS, Judge.
Ernest L. Mollohan filed a detinue complaint against Dennis Posey, asserting that Mollohan was the owner of two Tennessee walking horsesa two-year-old stallion named "Under Score" and a four-year-old mare named "Bootylicious"; that the horses were in the possession of Posey, a farrier and trainer; and that Posey had refused to return the horses to him. Mollohan sought an order for pretrial seizure of the horses, pursuant to Rule 64, Ala. R. Civ. P., and, ultimately, a ruling that he was entitled to "permanent possession" of the horses.
Posey answered the complaint and admitted that he had possession of the horses and that he had refused to return the horses to Mollohan, but, he asserted, his *255 refusal was based upon rights that, he claimed, arose from a statutory agister's and trainer's lien pursuant to § 35-11-70, Ala.Code 1975.[1] Posey also admitted that Mollohan had an interest in the horses, but, he claimed, the parties had entered into an oral agreement according to which Mollohan had paid the initial purchase price of the horses and Posey had agreed to board and train the horses and, upon the sale of the horses, Mollohan would be reimbursed his purchase money and the parties would divide the remaining proceeds equally. Posey also counterclaimed, alleging (1) that Mollohan had breached the parties' agreement by unreasonably withholding his consent to a sale of the stallion for $45,000 to a buyer in Tennessee and (2) that Mollohan had made defamatory statements that "injured [Posey's] reputation and stature in the close-knit Tennessee-walking-horse community."
The trial court conducted a bench trial on March 8, 2006. The following evidence was undisputed: Mollohan had previously placed other horses with Posey for a fixed monthly boarding and training fee of $400 per horse. On the occasion at issue in this case, however, the parties had an oral agreement that Posey would care for and train the horses but that, instead of a monthly fee, Mollohan would pay Posey half the proceeds of the sale of the horses, minus Mollohan's original purchase price of the horses$2,850 for the stallion and $2,000 for the mare. The agreement contemplated that Posey would market the horses, locate buyers for the horses, and eventually sell the horses, but that Mollohan would be consulted and would be allowed to speak to the prospective buyers before any sales.
Mollohan testified that he thought Posey had breached the parties' oral agreement by failing to notify him of offers to buy the horses, by failing to inform him of the identity of prospective buyers, by preventing him from speaking with prospective buyers, and by indicating, on documents of sale, that he was the owner of the horses. Mollohan stated:
"[O]n several occasions I asked Dennis [Posey] who the prospective buyers were and he refused to tell me because he said they were his clients and not mine, that I would be notified after the sale how much the horses would be sold for. And I repeatedly asked him to call me so I [could] talk with the buyer. Since I'm the owner, I'm the one that has to sign off on the horses before the horses are sold. And if I feel like it is a good offer, then I will take the offer because the bottom line is they are my horses and [Posey] refused to tell me."
Mollohan denied that Posey had ever relayed to himmuch less that he (Mollohan) had rejectedan offer to buy the stallion for $45,000. Mollohan testified that in December 2005 he had traveled to a horse farm in Tennessee and had seen a bill of sale containing Posey's name in the space designated for the prior purchaser (and, thus the owner) of the horses, whereupon he halted the impending sale and demanded that Posey return the horses to him. Following Posey's repeated refusals *256 to return the horses or to inform Mollohan of their whereabouts, Mollohan filed the detinue action on January 13, 2006.
Posey testified that he considered himself a "co-owner" of the horses or a "partner" in the venture to train and sell the horses, because, he said, he had "put a lot more money in [the horses] than [Mollohan] has." When asked how much he had paid for the horses at the time of their initial purchase, Posy answered, "I bought my half [of the horses] on agreement" to board and train them. Posey acknowledged that he had presented no evidence, other than his own testimony, indicating that he had received an offer of $45,000 for the stallion. Posey presented no evidence to support his counterclaim alleging defamation.
On October 11, 2006, the trial court entered the following judgment: "The Court finds in favor of [Mollohan] and does order [Posey] to return the horses immediately." On November 1, 2006, Posey filed a postjudgment motion, arguing that the judgment was contrary to the great weight of the evidence and insisting that he was entitled to be compensated for "the boarding, feeding, care, shoeing and training of the horses" under one of the following theories: (1) unjust enrichment; (2) an agister's and trainer's lien, pursuant to § 35-11-70; or (3) "quantum meruit, contract, indebitatus assumpsit, account, open account, or general equitable principles." The trial court set the postjudgment motion for a hearing on January 9, 2007. However, the trial court failed to rule on the motion, and it was denied by operation of law pursuant to Rule 59.1, Ala. R. Civ. P., on January 30, 2007. Posey filed a timely notice of appeal on March 9, 2007.
"In Alabama, `[i]t is elementary that the gist of [a detinue action] is the wrongful detention.'" Bruner v. Geneva County Forestry Dep't, 865 So.2d 1167, 1174 (Ala.2003) (quoting Jesse French Piano & Organ Co. v. Bradley, 138 Ala. 177, 180, 35 So. 44, 44 (1902))(material in brackets added by the court in Bruner). See also Friedman v. Friedman, 971 So.2d 23, 29 (Ala.2007)(holding that former daughter-in-law was not liable for common-law detinue in absence of evidence indicating that she had wrongfully taken items owned by mother-in-law and father-in-law that were stored in safe); Thrasher v. Thrasher, 674 So.2d 595, 597 (Ala.Civ.App.1995)(holding that wife was not liable for common-law detinue of a house trailer that husband had delivered to her in return for her promise not to testify against him in a criminal case).
The Alabama Supreme Court has held that a horse cannot be recovered in a detinue action against one who has a valid agister's and trainer's lien because the statute creating such a lien allows the trainer "to retain such horse, horses, cattle, livestock or stock, or so many thereof as may be necessary for the payment of such charges." See Elledge v. Hotchkiss, 222 Ala. 129, 130 So. 893 (1930) (construing predecessor to § 35-11-70), and Finney v. Dryden, 214 Ala. 370, 108 So. 13 (1926) (same). In Elledge v. Hotchkiss, the owner of two race horses delivered his horses to a trainer with the understanding that the owner would pay for the upkeep of the horses while they were being trained and, thereafter, that the owner and trainer would deduct the cost of upkeep from the horses' earnings, with the remainder of the horses' earnings to be divided equally between the owner and the trainer. At the end of the racing season, the trainer, asserting an agister's and trainer's lien, refused to surrender possession of the horses unless the owner reimbursed him for the expenses of upkeep that he had advanced in excess of the horses' earnings.
*257 The Alabama Supreme Court held that, if the trainer had an agister's and trainer's lien, then the horses could not be recovered in detinue because the trainer's retention of the horses for the payment of expenses was authorized by the statute granting him a lien on the horses. The court pointed out, however, that the statutory lien "runs to a bailee for hire to secure his charges for keeping, feeding, pasturing, training, or developing the bailed property for the owner." Elledge v. Hotchkiss, 222 Ala. at 130, 130 So. at 895 (emphasis added). The court indicated that, if the arrangement between the owner and trainer was a "joint adventure, and what was done by the [trainer] in keeping and training the ... horses was as much for his benefit as it was for the benefit of the [owner]," then the trainer's expenses were "not within the provisions of the [agister's and trainer's lien] statute." Id.
Although neither party has raised an issue concerning this court's jurisdiction in this case, we must first consider whether this court has jurisdiction over this appeal, because "`jurisdictional matters are of such magnitude that we take notice of them at any time and do so even ex mero motu.'" Wallace v. Tee Jays Mfg. Co., 689 So.2d 210, 211 (Ala.Civ.App. 1997) (quoting Nunn v. Baker, 518 So.2d 711, 712 (Ala.1987)). Section 12-22-2, Ala. Code 1975, provides, in pertinent part, that an appeal will lie to the appropriate appellate court "[f]rom any final judgment of the circuit court." "A `final judgment is a "terminal decision which demonstrates there has been a complete adjudication of all matters in controversy between the litigants."'" Horton v. Horton, 822 So.2d 431, 433 (Ala.Civ.App.2001) (quoting Dees v. State, 563 So.2d 1059, 1061 (Ala.Civ.App. 1990)).
In this case, Posey has attempted to appeal from the trial court's order granting the relief sought in Mollohan's detinue complaint despite the trial court's failure to rule on Posey's affirmative defensesthat he was justified in retaining possession of the horses pursuant to an oral contract and pursuant to a statutory lien. The latter defense not only sets forth grounds for defeating Mollohan's detinue claim, see Elledge v. Hotchkiss, supra, and Finney v. Dryden, supra, but also states a claim for affirmative relief. Because Posey's "defense" sought affirmative relief, it wasin substance if not in forma "claim" that, left unadjudicated, affected the finality of the trial court's October 11, 2006, order. Cf. Rule 8(c), Ala. R. Civ. P. (stating that "[w]hen a party has mistakenly designated a defense as a counterclaim or a counterclaim as a defense, the court on terms, if justice so requires, shall treat the pleading as if there had been a proper designation"); Baldwin-United Corp. v. Thompson (In re Baldwin-United Corp.), 48 B.R. 49, 56 (Bankr.S.D.Ohio 1985) (citing Rule 8(c), Fed.R.Civ.P., and noting that because the "affirmative defenses set forth claims for affirmative relief rather than grounds for defeating the plaintiffs' claim, the Court will deem them solely as counterclaims and setoffs"); and Summerlin v. Summerlin, 962 So.2d 170, 173 (Ala.2007), in which our supreme court stated:
"In form, [the wife's] `claim' [seeking injunctive relief] appears to be separate and distinct from [the father-in-law's] breach-of-contract counterclaim. If one looks beyond form, however, [the father-in-law's] breach-of-contract counterclaim is, in substance, a defense to [the wife's] petition for injunctive relief."
The trial court also failed to rule on Posey's counterclaimsthat Mollohan breached the parties' oral contract by unreasonably withholding his consent to an *258 offer to buy the stallion and that Mollohan defamed him.
With respect to the counterclaim alleging defamation, Posey neither presented any evidence at trial in support of that claim nor mentioned it in his postjudgment motion. We conclude that the trial court's failure to rule on that counterclaim probably does not affect the finality of the judgment. See Poston v. Gaddis, 372 So.2d 1099, 1101 (Ala.1979) (stating that "when no evidence is presented concerning a claim, the court's oral charge to the jury makes no mention of such claim and judgment is rendered on all other issues presented and covered by the oral charge, then the judgment will be considered a final judgment as to all issues"); Dixon v. Davis, 823 So.2d 1275, 1277 n. 1 (Ala.Civ.App.2001) (stating that "because Dixon presented no argument regarding his [wantonness] counterclaim at trial, because the jury was not charged regarding the counterclaim, and because neither verdict form nor the trial court's judgment mention Dixon's counterclaim, the trial court's judgment was a final judgment that disposed of Dixon's counterclaim").
Nevertheless, because the trial court failed to rule on Posey's other counterclaim alleging breach of contract, as well as on Posey's statutory-lien defense seeking affirmative relief, those claims remain pending in the trial court. "When, as here, a trial court enters a ... judgment as to fewer than all claims in a case, but does not make an express determination that there is `no just reason for delay' and does not direct the entry of judgment, the... judgment is not a final judgment within our appellate jurisdiction." Wallace v. Tee Jays Mfg. Co., 689 So.2d at 211. Although "we have the discretion to remand for the entry of an order pursuant to Rule 54(b), [Ala. R. Civ. P.,] so as to allow our exercise of appellate jurisdiction ... Rule 54(b) certifications `should be made only in exceptional cases.'" Id. at 212. "[I]n an action involving claims and counterclaims, Rule 54(b) certification has been determined to be improvident where the issues in the claims were deemed to be `so closely intertwined that separate adjudication would pose an unreasonable risk of inconsistent results.'" Fullilove v. Home Fin. Co., 678 So.2d 151, 154 (Ala.Civ.App.1996) (quoting Branch v. SouthTrust Bank of Dothan, N.A., 514 So.2d 1373, 1374 (Ala. 1987)). In Branch v. SouthTrust Bank of Dothan, N.A., our supreme court stated:
"The facts of this case, however, do not present the type of situation that Rule 54(b) was intended to cover. The counterclaim asserted by [the borrower] is based upon an alleged fraudulent representation by an agent of [the lender] upon which [the borrower] claims he relied in executing the promissory note. It therefore appears that the issues in the two claims in this case are so closely intertwined that separate adjudication would pose an unreasonable risk of inconsistent results. We must conclude, therefore, that in the interest of justice, the claims should not be adjudicated separately."
514 So.2d at 1374. See also Schlarb v. Lee, 955 So.2d 418, 419-20 (Ala.2006); Hurst v. Cook, 981 So.2d 1143 (Ala.Civ.App.2007); and BB&S General Contractors, Inc. v. Thornton & Assocs., Inc., 979 So.2d 121 (Ala.Civ.App.2007).
In BB&S General Contractors, a contractor that had been hired to harvest timber sued the holder of the timber rights, asserting, among other claims, that the defendant had breached the contract by failing to pay it for performance under the contract. The defendant counterclaimed, alleging, among other things, that the contractor had breached the contract by failing to perform the timber-cutting *259 contract properly. The trial court entered a summary judgment on all the counterclaims and certified that judgment as final under Rule 54(b). This court held that the trial court had erred in certifying the judgment as final because
"the interpretation of the contract and a determination as to which party breached the contract is central to the parties' contract claims; accordingly, the parties' contract claims are dependent on each other and a resolution of one claim would impact the determination of the other."
979 So.2d at 125.
In the present case, the evidence was undisputed that the parties had an oral contract with respect to boarding, training, and selling the horses, yet the trial court did not adjudicate the competing breach-of-contract claims that were tried by the express or implied consent of the parties. Nor did the court determine whether Posey had an agister's and trainer's lien pursuant to § 35-11-70, an issue that was intertwined not only with the merits of Mollohan's detinue claim, but also with the issue of what damages or setoff could have been awarded on the breach-of-contract claims. Accordingly, we conclude that the trial court's order of October 11, 2006, was a nonfinal judgment that could not properly have been certified as final under Rule 54(b), Ala. R. Civ. P., and that the appeal must be dismissed.
APPEAL DISMISSED.
THOMPSON, P.J., and PITTMAN, BRYAN, and MOORE, JJ., concur.
NOTES
[1]  Section 35-11-70 provides, in pertinent part:

"[A]ny person who keeps, fattens, feeds, cares for, trains or develops any horse, horses, cattle or livestock for another shall have a lien on all such horses, cattle or livestock so kept, fed, pastured, trained, cared for, fattened or developed by him, or under his control, for the payment of his charges for keeping, feeding, pasturing, training, caring for, fattening or developing the same, and he shall have the right to retain such horse, horses, cattle, livestock or stock, or so many thereof as may be necessary for the payment of such charges."
(Emphasis added.)
