One of the CIA’s highest-ranking women, who once ran a CIA prison in Thailand where terror suspects were waterboarded, has been bypassed for the agency’s top spy job.

The officer, who remains undercover, was a finalist for the job and would have become the first female chief of clandestine operations.

As one of the last remaining senior CIA officers who held leadership roles in the agency’s interrogation and detention program, however, she was a politically risky pick.

Sen. Dianne Feinstein, the Senate Intelligence Committee’s top Democrat, has criticized the interrogation program and personally urged CIA Director John Brennan not to promote the woman, according to a former senior intelligence briefed on the call.

Through a spokesman, Feinstein said she “conveyed my views to Mr. Brennan.”

In deciding to replace the officer at the top of the CIA branch responsible for agency espionage and covert action programs, Brennan could be sending a signal that he intends to shift the agency’s focus after more than a decade of intense manhunting and paramilitary operations — as well as put distance between his tenure and the agency’s controversial detention and interrogation program.

Brennan also passed over the head of the agency’s Counterterrorism Center, who for years has managed the CIA’s escalation of drone strikes in Pakistan and other countries.

Instead, he turned to a career undercover officer in his 50s who has served in Pakistan and several countries in Africa and Latin America. Former officials say the officer once ran the covert action that helped remove Serbian President Slobodan Milosevic from power. That program is regarded inside the CIA as a blueprint for running a successful peaceful covert action.A CIA news release on Tuesday said that the officer would remain undercover in his new job, a rarity for an agency officer in that position.

More than a decade after it last used waterboarding, the CIA is still hounded by the legacy of tactics that America once considered torture. Brennan’s ties to the interrogation program delayed for years his nomination to lead the CIA and Feinstein wants the agency to declassify a 6,000-page report on the interrogation program.

While many details about the program have become public, much is still shrouded in secrecy, making it impossible to evaluate its successes. Harsh interrogations led to some information, but also generated a lot of false information. And whether any of it could have been done without waterboarding, sleep deprivation and forcing people into small boxes is unknowable.

The name of the new head of the clandestine service is widely known in intelligence, diplomatic and journalistic circles, as is the name of the woman who was passed over. Both have declared their CIA affiliations with foreign governments around the world.

One former CIA officer saw the choice as a Brennan nod to Capitol Hill.

“It’s a very political job. Its first criterion is not that you are a super spook. It’s to handle all the … politics of the clandestine service,” including working with Congress, said former intelligence officer Reuel Gerecht, now at the Foundation for Defense of Democracies, a Washington-based think tank. “Brennan was not going to put anyone in that position who had done anything controversial in any way.”

In announcing his new clandestine chief, Brennan also promoted women to be his chief of staff and the agency’s executive director.

“Women will hold fully half of the positions on his current leadership team,” the agency said in a news release.