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

Facing tough questioning by members of the Senate intelligence committee, Gina Haspel insisted her “moral compass is strong.” If confirmed, she said she would not permit the CIA to restart the kind of harsh detention and interrogation program the spy agency ran at black sites after 9/11 and tainted American’s image worldwide.

“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.”

Haspel, who is currently acting CIA director, was responding to a question about what she would do if Trump ordered her to do something she thought was 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.”

“I don’t believe that torture works,” Haspel said, adding that she doesn’t think Trump would ever ask her to resume waterboarding.

The 61-year-old intelligence professional, who has served in undercover assignments both domestically and abroad for more than three decades, faces what will likely be a close confirmation vote in the full Senate. Her nomination has become contentious because she was chief of base of a covert detention site in Thailand where terror suspects were waterboarded. There also have been questions about how she drafted a cable that her boss used to order the destruction of videotapes of interrogation sessions conducted at the site.

Senators grilled Haspel and her hearing was disrupted by protesters shouting “Prosecute the torturers!” and “Bloody Gina.” Haspel remained stone-faced as police escorted them out of the room.

“I realize that there are strong disagreements on the effectiveness of the CIA’s detention and interrogation program,” Haspel wrote in answers to more than 100 questions submitted by committee members and released at her hearing.

“In my view — a view shared by all nine former directors and acting directors — the CIA was able to collect valuable intelligence that contributed to the prevention of further terrorist attacks. That said, it is impossible to know whether the CIA could have obtained the same information in another way.”

She also said that there is little question that the program harmed CIA officers who participated and damaged U.S. relations with allies.

“If confirmed as director, I would not permit CIA to restart such a detention and interrogation program. Nor will I support the U.S. government using enhanced interrogation techniques again. Current law prohibits their use and I support that law.”

Being in the public spotlight is new for Haspel. She has spent more than 30 years working undercover, acquiring secret information from dead drops and at meetings in dusty back alleys of third-world capitals.

Still, 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 as the eldest of five children. While her family has deep roots there, she grew up as an Air Force “brat,” following her father to postings all over the world.

If confirmed, she would become the first woman to direct the CIA. She joined the agency in 1985 and said she quickly discovered that she had a “knack for the nuts and bolts” of the profession. She met her first foreign agent on a dark, moonless night at an undisclosed location abroad.

“When I picked him up, he passed me the intelligence and I passed him an extra $500 for the men he led,” she said. “It was the beginning of an adventure I had only dreamed of.”

She staunchly defended her role in the 2005 destruction of the videotapes. 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. She said, however, that she would not support destroying them today.

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.

Haspel has received strong backing from former top intelligence officials, but after the 3 ½-hour hearing, two top Democrats on the committee, Sens. Mark Warner of Virginia and Dianne Feinstein of California, said some of her answers lacked clarity.

“She makes a very sympathetic presentation, but there’s a lot of history there and we need to know what it is,” Feinstein said. “And we need to know, is she strong enough? And I was disappointed in certain answers.”

Her opponents outside Congress lashed out.

More than 100 former U.S. ambassadors who served both Republican and Democratic presidents sent the Senate a letter opposing Haspel, saying that despite her credentials, confirming her would give authoritarian leaders around the world the license to say U.S. behavior is “no different from ours.”

Associated Press Writer Mary Clare Jalonick contributed to this report.