
506 N.W.2d 686 (1993)
244 Neb. 328
NEBRASKA PUBLIC EMPLOYEES LOCAL NO. 251, AMERICAN FEDERATION OF STATE AND COUNTY MUNICIPAL EMPLOYEES, AFL-CIO, Appellee,
v.
CITY OF OMAHA, a Municipal Corporation, Appellant.
No. S-91-634.
Supreme Court of Nebraska.
October 15, 1993.
*688 Herbert M. Fitle, Omaha City Atty., Kent N. Whinnery, Wendy E. Hahn, and Mary M. Elliston, Omaha, for appellant.
Thomas F. Dowd, of Dowd & Dowd, Omaha, for appellee.
Before HASTINGS, C.J., and BOSLAUGH, WHITE, CAPORALE, SHANAHAN, FAHRNBRUCH, and LANPHIER, JJ.
SHANAHAN, Justice.
This contract action between the Nebraska Public Employees Local No. 251 (Union) and the City of Omaha (City) concerns the contractual right of female jail detention technicians to bid for work shifts based on seniority under the Collective Bargaining Agreement (CBA) between the City and the Union. The district court found the City had violated the CBA, permanently enjoined the City from assigning work shifts based on its unilateral policy, and ordered that the work shifts for female detention technicians be rebid according to provisions of the CBA.

STANDARD OF REVIEW
"An injunction is a remedy available through an equity action." Chambers-Dobson, Inc. v. Squier, 238 Neb. 748, 750, 472 N.W.2d 391, 395 (1991). Accord, K N Energy, Inc. v. Cities of Broken Bow et al., 244 Neb. 113, 505 N.W.2d 102 (1993); Burton v. Annett, 215 Neb. 788, 341 N.W.2d 318 (1983).
In an appeal of an equity action, an appellate court tries factual questions de novo on the record and reaches a conclusion independent of the findings of the trial court; provided, where credible evidence is in conflict on a material issue of fact, an appellate court considers and may give weight to the fact that the trial judge heard and observed the witnesses and accepted one version of the facts rather than another.
Chambers-Dobson, Inc. v. Squier, 238 Neb. at 750, 472 N.W.2d at 395. Accord, In re Estate of Stephenson, 243 Neb. 890, 503 N.W.2d 540 (1993); Gottsch v. Bank of Stapleton, 235 Neb. 816, 458 N.W.2d 443 (1990); Hughes v. Enterprise Irrigation Dist., 226 Neb. 230, 410 N.W.2d 494 (1987). See Neb. Rev.Stat. § 25-1925 (Cum.Supp.1992).

BACKGROUND
Since 1983, detention technicians I and II working in the City's jail facility have been classified as employees within the bargaining unit covered by the CBA between the Union and the City. The City's jail facility houses both female and male detainees. The duties of detention technicians include booking and searching prisoners and observing prisoners in their cells.
Since 1983, the CBA's provisions for shift-bidding and seniority rights have not been modified by negotiations between the Union and the City. The CBA was admitted into evidence without objection and details how employees covered by the CBA select, or bid for, work shifts based on seniority. The CBA provides in relevant part:
When the work day is divided into more than one shift on the first regularly scheduled working day in January of each year, the CITY shall post a notice designating the hours of shifts and the number of employees required for each shift. Employees shall have fifteen days in which to submit their bids in writing to the Labor Relations Office for the shift they desire. Effective on the first regularly scheduled working day in February, employees shall be assigned said shifts on the basis of their bids by exercising their seniority right under Article 8, Section 1.
The CBA further states that "[s]eniority is hereby defined as the employee's length of continuous service in the bargaining unit except as otherwise provided herein."
Thomas Marfisi, director of labor relations for the City, testified that the CBA entitled classified employees to bid for shifts based on the employee's seniority. He further testified that the language of the contract provided "no exceptions to that rule." Marfisi also testified that while detention technicians *689 were only a small percentage "of the group represented by that labor contract," technicians were still "entitled to the benefit of that agreement."
John Foster, the Union's vice president, testified that in January 1991, the City unilaterally adopted a policy limiting the shift-bidding rights of female detention technicians. The City's new policy for bidding was expressed in a memorandum entitled "Inter-Office Communication" which was dated January 25 and informed "All Detention Section Personnel" that 1991 watch schedules had been determined and detention technicians I could bid for days off based on seniority. The Union complained about the memo's statement, "Note: Any schedule choice wich [sic] does not ensure at least one female Detention Technician is assigned to be on duty each day will not be an available choice."
The City based its policy on Neb.Rev.Stat. § 47-111 (Reissue 1988) and the "Nebraska Jail Standards Regulations" promulgated pursuant to the statute. See Standards for Jail Facilities, 81 Neb.Admin.Code, ch. 2, § 003.02A (1984). Section 47-111 and its accompanying regulation require that every county jail have a "matron" on duty 24 hours a day to supervise female prisoners.
In January 1991, the staff for the City's jail consisted of six female and nine male detention technicians I and four female and one male detention technicians II. Therefore, the City's jail had a staff of 20 detention technicians I and II, 10 of whom were females.
Detention manager Frederick Power, when asked whether the City required a particular classification of a female detention technician to satisfy its policy, answered that the interoffice policy memo was "addressed to Detention Technicians I to insure that onethat one of those would always be available." According to Power, the policy required that a female detention technician I always be on duty even if a female detention technician II was available and even though having a female detention technician II on duty would satisfy the requirements of the Nebraska Jail Standards Regulations.
In January 1991, Brenda Rocha, a detention technician I with adequate seniority, bid on the C shift, from 3 to 11 p.m. However, the City assigned Rocha to work the B shift, from 7 a.m. to 3 p.m.
The Union filed suit on January 31, 1991, and requested injunctive relief against the City's policy affecting employees' rights under the CBA. The City filed no answer in the lawsuit. During trial, the City presented evidence that the CBA had remained essentially the same from 1983 until the Union brought suit. After a hearing on the Union's request for temporary and permanent injunctive relief, the district court found the City's policy violated the CBA and resulted in a denial of bargaining unit employees' contractual rights. The district court permanently enjoined the City from assigning work shifts on the basis of its policy and ordered the City to have the work shifts rebid and assigned according to the CBA's provisions.

ASSIGNMENTS OF ERROR
As its first assignment of error, the City contends that the district court erred in determining that the CBA applied to the detention technicians at the City's jail facility. In its second, third, and fourth assignments of error, the City maintains the district court erred in not finding a conflict between the City's obligations under the CBA and its duty to abide by § 47-111 and the Nebraska Jail Standards Regulations. In essence, the City argues that compliance with the CBA's provisions on shift-bidding and state law requiring that female jail guards be on duty 24 hours a day is impossible and that state law supersedes the CBA adopted as a City ordinance. In its fifth assignment of error, the City asserts that the district court erred in not dismissing the action because of the statute of limitations or laches.

AFFIRMATIVE DEFENSES
As one of the statutory provisions for pleadings in civil cases, Neb.Rev.Stat. § 25-811 (Reissue 1989) provides that "[t]he answer shall contain (1) a general or specific denial of each material allegation of the petition controverted by the defendant; and (2) a statement of any new matter constituting a *690 defense, counterclaim or setoff, in ordinary and concise language, and without repetition." Neb.Rev.Stat. § 25-812 (Reissue 1989) authorizes a defendant to plead an affirmative defense. "An affirmative defense raises new matter which, assuming the allegations in the petition to be true, constitutes a defense to the merits of a claim asserted in the petition." Hogan v. State Farm Auto. Ins. Co., 607 So.2d 747, 751 (La.App.1992). "The essence of affirmative defenses is to concede that while the plaintiff otherwise may have a good cause of action, the cause of action no longer exists because some statute or rule permits defendant to avoid liability for the acts alleged." Brown v. Ehlert, 255 Mont. 140, 146, 841 P.2d 510, 514 (1992). "An affirmative defense generally admits the matters alleged in a complaint but brings up some other reason why the plaintiff has no right to recovery. It thus introduces arguments not raised by a simple denial." Van Schouwen v. Connaught Corp., 782 F.Supp. 1240, 1246 (N.D.Ill.1991).
An affirmative defense must be pleaded to be considered in the trial court and on appeal. See, Lease Northwest v. Davis, 224 Neb. 617, 400 N.W.2d 220 (1987); Kansas-Nebraska Nat. Gas Co., Inc. v. Hawkeye-Security Ins. Co., 195 Neb. 658, 240 N.W.2d 28 (1976). An affirmative defense not raised or litigated in the trial court cannot be urged for the first time on appeal. See Guaranteed Foods v. Rison, 207 Neb. 400, 299 N.W.2d 507 (1980). See, also, Lease Northwest v. Davis, supra; Kansas-Nebraska Nat. Gas Co., Inc. v. Hawkeye-Security Ins. Co., supra.
The rationale for requiring the defendant to plead a specific defense is to set forth the defense so that the plaintiff may be advised of the exact defense he or she will be required to meet and the trial court may be informed as to the exact issues to be determined.
Plock v. Crossroads Joint Venture, 239 Neb. 211, 226-227, 475 N.W.2d 105, 116 (1991). Accord Timmerman v. Hertz, 195 Neb. 237, 238 N.W.2d 220 (1976). "The burden of both pleading and proving affirmative defenses is upon the defendants, and when they fail to do so they cannot recover upon mere argument alone." First Nat. Bank v. Benedict Consol. Indus., 224 Neb. 860, 865, 402 N.W.2d 259, 262 (1987). See, also, Center Bank v. Mid-Continent Meats, Inc., 194 Neb. 665, 234 N.W.2d 902 (1975).
"[M]atters which seek to avoid a valid contract are affirmative defenses." Lease Northwest v. Davis, 224 Neb. at 623, 400 N.W.2d at 224 (citing Honey v. Barnes Hosp., 708 S.W.2d 686 (Mo.App.1986)). "An affirmative defense must be pleaded in a contract action, and a general denial is not sufficient to raise any affirmative defense." Church of the Holy Spirit v. Bevco, Inc., 215 Neb. 299, 310, 338 N.W.2d 601, 607 (1983). "[I]f a petition, on its face, does not disclose that an action is barred by a statute of limitations, a defendant must plead the statute of limitations as an affirmative defense and has the burden to prove that affirmative defense." Broekemeier Ford v. Clatanoff, 240 Neb. 265, 272, 481 N.W.2d 416, 421 (1992). Accord, L.J. Vontz Constr. Co. v. Department of Roads, 232 Neb. 241, 440 N.W.2d 664 (1989); Vielehr v. Malone, 158 Neb. 436, 63 N.W.2d 497 (1954). Laches is also an affirmative defense. See, National Wildlife Federation v. Burford, 835 F.2d 305 (D.C.Cir.1987), reh'g denied 844 F.2d 889 (D.C.Cir.1988); Cieszko v. Clark, 92 N.C.App. 290, 374 S.E.2d 456 (1988).
The City does not dispute that in 1991, when the labor disagreement arose, detention technicians at the City's jail facility were covered by the CBA. However, the City now attempts to excuse its nonperformance of the CBA by asserting impossibility of performance. In that posture, the City is attempting to use an affirmative defense which was not raised at the trial level. See Lease Northwest v. Davis, supra. Also, the City urges us to consider the defenses of the statute of limitations and laches for reversal of the district court's decision. The statute of limitations for commencement of an action for breach of contract is 5 years. See Neb.Rev.Stat. § 25-205 (Reissue 1989). We note that the Union's petition alleged that the City adopted a unilateral policy in January 1991 concerning a bidding procedure which was not authorized by the CBA. If somehow the 5-year statute of limitations or *691 laches afforded the City a defense to the Union's action, the City was required to plead the statute of limitations and laches as affirmative defenses. Because the City has failed to file an answer and affirmatively plead the defenses of impossibility of performance, the statute of limitations, and laches, we will not consider any of the City's assignments of error based on those affirmative defenses which were not raised in the trial court. Therefore, the City's assignments of error, based on affirmative defenses, are rejected under the circumstances.
From our de novo review on the record, we reach the same factual conclusion as that reached by the trial court: The CBA's existence and validity are undeniable and, for that matter, appear to have been admitted by the City in the course of trial and in this appeal, as reflected by the City's statement that the CBA "remained essentially the same from 1983 through the date of these proceedings in 1991." Brief for appellant at 5. Also, we find, as did the district court, that the City has breached its contractual duty under the valid bargaining agreement with the Union when the City denied Rocha her right to shift-bidding based on her seniority as a detention technician. The City's failure to raise any affirmative defense in its answer leaves no excuse for the City's failure to perform the collective bargaining agreement. Consequently, we affirm the district court's judgment ordering that the detention technicians' jobs be rebid and assigned in conformity with the CBA and permanently enjoining the City from assigning work shifts under its unilateral policy in violation of the collective bargaining agreement concerning shift-bidding based on seniority.

ATTORNEY FEE
The Union requests an attorney fee and costs as the result of our affirmance of the district court's judgment. The Union contends that allowance of an attorney fee in this appeal is proper because the City's appeal is frivolous.
"In Nebraska, the general rule is that an attorney fee may be recovered only when authorized by statute, or when a recognized and accepted uniform course of procedure allows recovery of an attorney fee." Chambers-Dobson, Inc. v. Squier, 238 Neb. 748, 765, 472 N.W.2d 391, 402 (1991). In Lutheran Medical Center v. City of Omaha, 229 Neb. 802, 810, 429 N.W.2d 347, 352 (1988), we said:
Neb.Rev.Stat. § 25-824(2) ... authorizes and requires that the court in which an action is commenced or an appellate court "shall award as part of its judgment and in addition to any other costs otherwise assessed reasonable attorney's fees and court costs against any attorney or party who has brought or defended a civil action that alleges a claim or defense which a court determines is frivolous or made in bad faith."
Neb.Rev.Stat. § 25-824(5) (Reissue 1989) provides that "[n]o attorney's fees or costs shall be assessed if a claim or defense was asserted by an attorney or party in a good faith attempt to establish a new theory of law in this state...."
In determining the amount of a cost or an attorney's fee award pursuant to subsection (2) of section 25-824, the court shall exercise its sound discretion. When granting an award of costs and attorney's fees, the court shall specifically set forth the reasons for such award and shall, in determining whether to assess attorney's fees and costs and the amount to be assessed against offending attorneys and parties, consider the following factors, including, but not limited to: [the statute continues listing a number of factors for the court to consider].
Neb.Rev.Stat. § 25-824.01 (Reissue 1989).
In Lutheran Medical Center v. City of Omaha, 229 Neb. at 814, 429 N.W.2d at 354, we defined "frivolous" as "a legal position wholly without merit, that is, without rational argument based on law and evidence to support a litigant's position in the lawsuit." Accord, Sports Courts of Omaha v. Meginnis, 242 Neb. 768, 497 N.W.2d 38 (1993); Shanks v. Johnson Abstract & Title, 225 Neb. 649, 407 N.W.2d 743 (1987). A "frivolous" legal position "connotes an improper motive or a legal position so wholly without merit as to be ridiculous." Behrens *692 v. American Stores Packing Co., 236 Neb. 279, 288, 460 N.W.2d 671, 677 (1990). See, Peterson v. Don Peterson & Assoc. Ins. Agency, 234 Neb. 651, 452 N.W.2d 517 (1990); Lutheran Medical Center v. City of Omaha, supra. "Any doubt whether a legal position is frivolous or taken in bad faith should be resolved in favor of the one whose legal position is in question." Sports Courts of Omaha v. Meginnis, 242 Neb. at 777, 497 N.W.2d at 44.
Here, even if we were to give the City the benefit of a general denial which was never pled, inasmuch as the City failed to file an answer in the trial court, nevertheless, the fact remains that the CBA is conclusively established and even admitted by the City without any pleaded excuse or justification for nonperformance. Since the City is without rational argument based on law to support its position, see Lutheran Medical Center v. City of Omaha, supra, the City's appeal is frivolous. For that reason, the Union is entitled to have an attorney fee assessed as a part of the costs recoverable from the City.
However, the Union has yet to comply with Neb.Ct.R. of Prac. 9 F (rev. 1992), which requires a party claiming an attorney fee to file a motion for allowance of a fee and to file a supporting affidavit which justifies the amount of the fee requested for services in an appellate court.
The Union asks us to "remand" this cause to the district court for a determination of an attorney fee for legal services in the district court proceedings. The record does not disclose that the district court has made any determination regarding an attorney fee. Therefore, this appeal presents nothing for us to review concerning an attorney fee allowable in the district court. Of course, after issuance of the mandate in this proceeding, the Union may ask the district court to consider allowance of an attorney fee. In light of our decision and § 25-824 concerning allowance of an attorney fee, the district court, after issuance of the mandate in this cause and on appropriate request, may consider whether an attorney fee should be awarded to the Union's lawyer for services in the district court.
AFFIRMED.
