I believe [latches] is an affirmative defense. However, I believe that it can be argued in the alternative. For example, your patent is invalid, we don't infringe, and even if it's not invalid and we do infringe, you're guilty of laches.
Jim is right, latches is a defense that you can argue in the alternative to non-infringement. I am stepping out on a limb here, but I believe it is actually what is called an "equitable defense", which means that, even if you lose on validity and infringement, the court can still refrain from enforcing the patent.
The Federal Circuit Bar Association Model Jury Instruction for laches (B.5.2), which is representative of other jury instructions on point, provides for delay in bringing suit as a basis for barring recovery by a patentee:
“[Alleged infringer] contends that [patent holder] is not entitled to recover damages for acts that occurred before it filed a lawsuit because: (1) [patent holder] delayed filing the lawsuit for an unreasonably long and inexcusable period of time, and (2) [alleged infringer] has been or will be prejudiced in a significant way due to [patent holder]’s delay in filing the lawsuit.”
So, in order to win a defense of laches, the alleged infringer must prove in court: “(a) the patentee's delay in bringing suit was unreasonable and inexcusable, and (b) the alleged infringer suffered material prejudice attributable to the delay.” The Federal Circuit actually once held that six years of delay creates a presumption of laches, eliminating the requirement for the infringer to show prejudice. A.C. Aukerman Co. v. R.L. Chaides Constr. Co., 960 F.2d 1020, 22 USPQ2d 1321 (Fed. Cir. 1992).
However, I don't know if you can move to dismiss the complaint based on laches. So, that may mean that a laches defense can only be raised at trial, or at earliest, summary judgment, which occurs after months or years of discovery.