SUMMARY ORDER
UPON DUE CONSIDERATION, IT IS HEREBY ORDERED, ADJUDGED AND DECREED that the judgment of the district court be, and it hereby is, AFFIRMED.
Plaintiff Tommy R. Jackson brought this action under 42 U.S.C. §§ 1983, 1985 and 1986 alleging false arrest and malicious prosecution in connection with his arrest in 1995. Jackson’s complaint alleged that defendant Michael Kwiek, a detective with the Syracuse Police Department, obtained the arrest warrant on the basis of false information, and that Kwiek conspired with the remaining defendants — Onondaga County Criminal Court Judge Kevin Mul-roy, Onondaga County District Attorney William Fitzpatrick and Assistant District Attorney Steve Cambaren, and various “unknown members of the Onondaga County District Attorney’s Office” — to obtain his conviction on charges of possession of stolen property. Jackson alleges that his initial conviction on such charges was reversed by the Appellate Division, Fourth Department and that he was later retried but acquitted of the same charges.
In a decision and order dated February 3, 2000, the district court granted Jackson’s motion to proceed informa pauperis, but dismissed his claims against Mulroy, Fitzpatrick and Cambareri on grounds of absolute immunity.
The district court’s February 3, 2000 order also directed Jackson “to file an amended complaint within thirty (30) days from the filing date of this order which sets forth a short and concise statement of his remaining claims.” The court warned Jackson that failure to file such an amended complaint “will result in dismissal of this action without further Order of the Court.”
*82Jackson appealed the February 3, 2000 order, but we dismissed the appeal nostra sponte on May 24, 2000, concluding that we lacked jurisdiction because no final order had been issued by the district court.
Jackson did not file an amended complaint, and on August 2, 2000, the district court entered an order dismissing the action “for Plaintiff’s failure to comply with the Court’s Order dated February 3, 2000.” This appeal followed.
While the district court did not specify the statutory basis for its dismissal of the claims against Mulroy, Fitzpatrick and Cambareri in its order of February 3, 2000, the dismissal was plainly authorized by 28 U.S.C. § 1915(e)(2). That provision allows a district court to dismiss a complaint filed informa pauperis “if the court determines that ... the action or appeal— (i) is frivolous or malicious; (ii) fails to state a claim on which relief may be granted; or (iii) seeks monetary relief against a defendant who is immune from such relief.” 28 U.S.C. § 1915(e)(2). We review a district court’s sua sponte dismissal under this provision de novo. See Liner v. Goord, 196 F.3d 132, 134 (2d Cir.1999).
Judges are absolutely immune from liability for conduct undertaken within their judicial capacity. See Fields v. Soloff, 920 F.2d 1114, 1119 (2d Cir.1990). Similarly, prosecutors are absolutely immune for activities “within the scope of [their] duties in initiating and pursuing a criminal prosecution.” Imbler v. Pachtman, 424 U.S. 409, 410, 417-19, 96 S.Ct. 984, 47 L.Ed.2d 128 (1976). We agree with the district court that all of the conduct in which Mulroy, Fitzpatrick and Cambareri are alleged to have engaged fell within the scope of these protections, and therefore affirm the dismissal of the complaint as against these defendants.
We also affirm the court’s dismissal of the complaint as against the remaining defendants in its order of August 2, 2000. Fed.R.Civ.P. 41(b) authorizes a district court to dismiss a plaintiffs case sua sponte for failure to prosecute or to comply with a court’s order. See LeSane v. Hall’s Security Analyst, Inc., 239 F.3d 206, 209 (2d Cir.2001). We review district court decisions to dismiss a case under this rule for abuse of discretion only. Id.
We recognize that a Rule 41(b) dismissal is “ ‘a harsh remedy to be utilized only in extreme situations,’ ” id. (citation omitted), and that pro se plaintiffs should be granted special leniency regarding procedural matters. Id. We nonetheless conclude that the district court’s order was appropriate in light of the factors to be considered before dismissing a complaint under this rule. These factors are: “[1] the duration of the plaintiffs failures, [2] whether plaintiff had received notice that further delays would result in dismissal, [3] whether the defendant is likely to be prejudiced by further delay, [4] whether the district judge has take[n] care to strik[e] the balance between alleviating court calendar congestion and protecting a party’s right to due process and a fair chance to be heard ... and [5] whether the judge has adequately assessed the efficacy of lesser sanctions.” Alvarez v. Simmons Mkt. Research Bureau, Inc., 839 F.2d 930, 932 (2d Cir.1988) (internal quotation marks and citations omitted).
There is no question that Jackson was on notice, in the form of the February 3, 2000 order, that his failure to file an amended complaint would result in dismissal of his claims. Nor did the district court fail to consider Jackson’s right to due process and the efficacy of lesser sanctions: the court permitted Jackson to proceed in forma pauperis and expressly invited him to submit a complaint more *83clearly spelling out the basis for his claims and the relief sought. Before dismissing the action, moreover, the court waited five months past the 30-day deadline it had given Jackson for filing an amended complaint. In these circumstances, the district court did not abuse its discretion.
For the foregoing reasons, the judgment of the District Court is hereby AFFIRMED.