The expected nomination of Comey, a Republican, was seen in some quarters as a bipartisan move by a president besieged by Republicans in Congress. (Mark Wilson/GETTY IMAGES)

President Obama plans to nominate James B. Comey, a former senior Justice Department official in the George W. Bush administration, to replace Robert S. Mueller III as FBI director, according to two people with knowledge of the selection process.

Comey, 52, was at the center of some of the most bruising debates over counterterrorism during the Bush administration and established a reputation as a fierce defender of the law and the integrity of the Justice Department regardless of the political pressures of the moment.

The expected nomination of Comey, a Republican, was seen in some quarters as a bipartisan move by a president besieged by Republicans in Congress. But Chuck Hagel’s prior service as a Republican senator from Nebraska did not spare him from a bruising nomination battle for secretary of defense.

Mueller has served 12 years as FBI director, a period of enormous transformation for the bureau in the aftermath of the Sept. 11, 2001, terrorist attacks. The director’s term is limited by law to 10 years, but Congress unanimously approved Obama’s request in 2011 that Mueller be granted another two years.

Comey was famously involved in a 2004 hospital-room confrontation with White House counsel Alberto Gonzales and the president’s chief of staff, Andrew H. Card Jr. The two White House officials were attempting to persuade Attorney General John D. Ashcroft, who was recovering from emergency surgery to remove his gallbladder, to reauthorize a controversial warrantless domestic eavesdropping program.

Comey, who was acting attorney general in Ashcroft’s absence, had refused to agree to extend the program. When he learned that the White House was attempting to go around him and get the ill Ashcroft to sign off on an extension, Comey rushed to George Washington University Medical Center, arriving just before Gonzales and Card.

Comey explained to Ashcroft what was happening and, when the White House officials arrived, the attorney general raised himself up and said he never should have authorized the program. He gestured at Comey and said, “There is the attorney general,” according to an account by former Washington Post reporter Barton Gellman.

The White House had narrowed the search in recent days to Comey and Lisa Monaco, a former assistant attorney general for national security who became Obama’s chief counterterrorism adviser this year. One law enforcement source said that a few weeks ago, the Justice Department sent both names to the White House for consideration.

Monaco would have been the first woman to lead the FBI, but Comey comes with extensive law enforcement experience. He served as the U.S. attorney for the Southern District of New York in Manhattan, and he was the managing assistant U.S. attorney in charge of the Richmond division of the U.S. Attorney’s Office for the Eastern District of Virginia. While in Richmond, he was credited with reducing the homicide rate by shifting gun prosecutions from state court to federal court, where the sentences were tougher. From 2003 though 2005, he served as deputy attorney general, responsible for overseeing the operations of the Justice Department.

“Jim is one of the great leaders of the Justice Department,” said Jamie Gorelick, who served as a deputy attorney general in the Clinton administration. “He has worked very closely with the bureau. He knows its strengths and will be great at enhancing its capabilities.”

The officials who said Comey was selected spoke on the condition of anonymity because they were not authorized to discuss a pending decision. They did not say how soon Obama would make the official announcement. News of Comey’s appointment was first reported by NPR.

A White House spokesman would not confirm the appointment Wednesday night, saying he had no personnel announcements to make.

Comey, who is married and has five children, could not be reached at home or work Wednesday for comment. He is a graduate of the College of William and Mary and the University of Chicago Law School.

Comey’s objection to the warrantless wiretapping — he told Congress that he would have resigned had the technique continued — was not his only brush with Bush-era policies. He also opposed the approval of enhanced interrogation techniques by the CIA. He said at the time that the Justice Department would eventually be ashamed of its legal backing when the world learned about the methods, which included waterboarding.

At the same time, in January 2005, he invoked the state secrets privilege in the civil case of a Syrian Canadian who was sent to Damascus in 2002 to be interrogated and was ultimately tortured.

Comey’s role in that episode elicited some criticism from civil liberties groups.

“James Comey’s nomination should raise serious concerns, and his role in the Bush administration needs to be examined,” said Michael Ratner, the president of the Center for Constitutional Rights. “We need to know the full story of his role in the torture memos. It does not sound like a great nomination. Recycling Bush people is not a good guarantee for the protection of civil liberties.”

Comey later came under criticism from some Bush administration officials for his role in selecting Patrick Fitzgerald to lead the special investigation into the leaking of the name of CIA officer Valerie Plame, a probe that led to the conviction of Vice President Dick Cheney’s adviser Scooter Libby.

Comey prosecuted numerous terrorism cases while in New York and created a specialized unit to go after international drug cartels. While in Virginia, he handled the case that arose out of the 1996 bombing of a U.S. military facility in Saudi Arabia.

Comey has prosecuted a variety of other types of cases, including the 1993 racketeering and murder trial of New York mob boss John Gambino.

Comey left the Justice Department in 2005 and served as a senior vice president and general counsel at the defense contractor Lockheed Martin until 2010. In June 2010, Comey joined Bridgewater Associates, a Connecticut-based hedge fund with $75 billion in investments for clients including universities and foreign governments.

He left the hedge fund in January and now teaches national security law at Columbia Law School in New York.

White House officials have been eager to send a nomination to Capitol Hill in order to complete the confirmation process and have the new director in place before Mueller must leave Sept. 4. Given summer recesses and the likelihood of Republican criticism, the White House is expected to formally announce Comey’s name soon.

Comey, if confirmed, will lead an agency whose primary mission is now counterterrorism. And until the Boston Marathon bombing, the FBI had been praised for its success in largely preventing terrorist attacks in the United States since Sept. 11, 2001.

Although Mueller has won bipartisan support on Capitol Hill through two administrations, the FBI has been criticized by civil liberties groups for its surveillance operations and aggressive sting operations, which defense lawyers say amount to entrapment.

Julie Tate contributed to this report.