Judge Shira A. Scheindlin, whose more-than-21-year tenure on the Federal District Court in Manhattan included a critical role in a controversial stop-and-frisk ruling affecting the Police Department, said on Wednesday that she would resign from the bench in late April.

“These have been the best years of my life,” Judge Scheindlin, 69, said in an email to her colleagues.

She wrote that she planned to spend the bulk of her time working as an arbitrator and mediator, doing public interest work and becoming of counsel to a law firm, which she did not identify.

It is unusual for federal judges, who have lifetime tenure, to leave the bench. Judge John Gleeson recently resigned from the federal court in Brooklyn and is joining a law firm.