WASHINGTON — President Obama’s announcement on Thursday that Attorney General Eric H. Holder Jr. would leave the administration sets up an election-season scramble for a replacement to carry on Mr. Holder’s civil rights crusade, wage rhetorical combat with Congress and manage the legal complexities of a presidency increasingly drawn into war with terrorists.

One of the earliest members of Mr. Obama’s cabinet, Mr. Holder, 63, became the nation’s first African-American attorney general and the president’s chief liberal warrior, especially on efforts to protect voter rights and end racial discrimination in the justice system. He also emerged as the primary political antagonist for a Republican opposition in Congress that viewed him as dismissive of existing laws and contemptuous of its oversight of his department.

That still-simmering anger among Republicans, who once voted to hold Mr. Holder in contempt of Congress, could be a political nightmare for Mr. Obama as he searches for a replacement who can win confirmation in the Senate. Democrats on Capitol Hill are bracing for attacks on any nominee involved in what Republicans consider scandals: political targeting by the Internal Revenue Service, the terrorist attacks on the American diplomatic mission in Benghazi or the numerous executive actions by Mr. Obama circumventing Congress.

Frequently mentioned candidates to replace Mr. Holder include Kathryn Ruemmler, the former White House counsel who remains close to Mr. Obama; Gov. Deval Patrick of Massachusetts; Solicitor General Donald B. Verrilli Jr.; former Gov. Jennifer M. Granholm of Michigan; Senator Sheldon Whitehouse, Democrat of Rhode Island, a former prosecutor; Preet Bharara, the United States attorney for the Southern District of New York; and Loretta E. Lynch, the United States attorney in Brooklyn. Mr. Patrick on Thursday said that it was not the right time for him to take such a job.