WASHINGTON — President Donald Trump’s nominee to be CIA director said Wednesday that she does not believe torture works and she would not carry out any presidential order she thought was immoral.

Facing tough questioning by members of the Senate Intelligence Committee, Gina Haspel said her “moral compass is strong.”

“I would not allow CIA to undertake activity that I thought was immoral, even if it was technically legal,” said Haspel, a 33-year veteran of the agency. “I would absolutely not permit it.”

She was responding to a question about what she would do if she received a directive from Trump that she found to be morally objectionable.

Trump has said he supports subjecting terror suspects to harsh interrogation tactics like waterboarding, which simulates drowning, and a “hell of a lot worse.” Haspel said Wednesday she doesn’t believe Trump would ask her to resume waterboarding and that CIA must undertake activities consistent with American values.

Haspel, 61, faces what will likely be a close confirmation vote in the full Senate, in part because she was chief of base of a covert detention site in Thailand where terror suspects were waterboarded.

Protesters shouting “Prosecute the torturers!” and “Bloody Gina” disrupted the hearing several times, and police escorted them out of the room. Haspel was stone-faced throughout.

Haspel said that she agrees with others at the CIA who have said that valuable information was obtained during the debriefing of al-Qaida detainees. But she adds that it’s not known whether harsh interrogation techniques “played a role in that.”

Haspel said the spy agency learned “tough lessons” from its use of harsh detention and interrogation tactics on terror suspects after 9/11.

“It is important to recall the context of those challenging times immediately following 9/11,” she said. “Having served in that tumultuous time, I can offer you my personal commitment, clearly and without reservation, that under my leadership, CIA will not restart such a detention and interrogation program.”

Committee chairman Sen. Richard Burr, R-N.C., who supports Haspel, stressed that the hearing was not about the now-defunct CIA interrogation program, but about who should lead the agency in the future as it faces current threats to U.S. national security.

Haspel said that being in the public spotlight is new for her because she spent more than 30 years “in the shadows” working undercover and acquiring secret information from dead drops and meetings in dusty back alleys of third-world capitals.

She portrayed herself as a “typical middle-class American” with a “strong sense of right and wrong” who just doesn’t happen to have any social media accounts. She said she was born in Kentucky and while her family has deep roots there, she grew up as an Air Force “brat,” following her father to postings all over the world.

Haspel emphasized her experience, saying, “I know CIA like the back of my hand.”

“I joined CIA in 1985 as a case officer in the clandestine service,” she said. “From my first days in training, I had a knack for the nuts and bolts of my profession. I excelled in finding and acquiring secret information.”

Haspel’s fate hinges on how well she fields tough questions from senators about details of her time running a covert detention site where terror suspects were waterboarded and seek an explanation for why she wanted videos of the sessions destroyed.

Last month, the CIA released a memo showing Haspel was cleared of wrongdoing in destroying the tapes. The Justice Department also investigated, but no charges were filed. The 2011 memo that the CIA released summarizes a disciplinary review conducted by then-CIA Deputy Director Mike Morell. He said that while Haspel was one of the two officers “directly involved in the decision to destroy the tapes,” he “found no fault” with what she did.

Asked whether she would support the destruction of the tapes today, Haspel said she would not. She said she never saw the videos and was not depicted on them, but that the destruction was important at the time to protect the CIA personnel showed on the tapes from being targeted by militants.

Haspel’s critics outside Congress argue that anyone who willingly participated in one of the CIA’s darkest chapters should not head the spy agency. They argue that having Haspel as the face of U.S. intelligence will undercut America’s effort to champion human rights.

Democrats have complained that the CIA has failed to declassify enough information on her career, leaving the public in the dark about the person who might end up leading the CIA.

Sen. Ron Wyden, D-Ore., and three of his Democratic colleagues recently wrote a letter to Dan Coats, the director of national intelligence, asking that his office, which oversees all U.S. intelligence agencies, declassify the documents.

Wyden warned it would set a damaging precedent “if this administration is allowed to get away with what I consider to be a secret confirmation” for the most visible official in U.S. intelligence.

If confirmed, Haspel said she will follow the legal framework the U.S. has since imposed that bans any tactic not spelled out in the Army Field Manual. Under U.S. law, all government employees, including intelligence agents, must abide by Army guidelines for interrogating prisoners — guidelines that don’t permit waterboarding.

Sen. Mark Warner, D-Va., said he appreciates that Haspel has acknowledged the history of the program and that she is committed to upholding the law, but “it is not enough.” He said “no one should get credit simply for agreeing to follow the law.”

Haspel said she would put more intelligence officers in the field abroad and says there has been an outpouring of support from young women at the CIA who hope she becomes the first female CIA director.

“It is not my way to trumpet the fact that I am a woman up for the top job, but I would be remiss in not remarking on it — not least because of the outpouring of support from young women at CIA who consider it a good sign for their own prospects,” Haspel said.