President Obama will formally nominate former Justice Department official James Comey as the next director of the FBI. (Joe Raedle/Getty Images)

President Obama on Friday will nominate former senior Justice Department official James B. Comey as the next FBI director, elevating a Republican to a top national security position at a time when the administration is facing questions about authorizing secret surveillance programs.

Comey, 52, served as acting attorney general in the George W. Bush administration and nearly resigned in 2004 over concerns he raised about electronic surveillance orders he thought to be illegal.

Bush reportedly backed down and halted the intelligence-gathering operations in the United States because of objections from Comey and others. But Comey’s role in the former program, called Stellar Wind, is likely to raise questions in the Senate, where nominees can be confirmed or blocked.

Comey would replace Robert S. Mueller III, who is leaving the agency after a dozen years.

In a statement, the White House called Comey “one of our nation’s most skilled and respected national security and law enforcement professionals. In more than 2 decades as a prosecutor and national security professional, Jim has demonstrated unwavering toughness, integrity, and principle in defending both our security and our values.”

Obama has been criticized by liberals and libertarians alike for recent revelations about the National Security Agency’s domestic surveillance programs, including the mass collection of phone and Internet records.

Comey 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.

His objection to the warrantless wiretapping was not his only brush with Bush-era policies. He also opposed the approval of enhanced interrogation techniques by the CIA.

Comey, who is married and has five children, left Justice in 2005 and served as a senior vice president and general counsel at the defense contractor Lockheed Martin.

In June 2010, Comey joined Bridgewater Associates, a Connecticut-based hedge fund; he left that firm in January to teach national security law at Columbia Law School in New York.