The Senate on Thursday confirmed Gina Haspel as the next CIA director despite opposition from most Democrats and a handful of Republicans who blasted her role in the agency’s enhanced interrogation program.

Lawmakers confirmed her in a 54-45 vote. Haspel is the first woman to serve as director of the CIA, succeeding Mike Pompeo, who was recently confirmed as secretary of state.

Haspel did not apologize for her role using enhanced interrogation techniques after 9/11 at her confirmation hearing before the Senate Intelligence Committee earlier this month and while she said torture doesn’t work, she also said that she believed the agency had obtained “valuable intelligence” through enhanced interrogation techniques that had helped to prevent terrorist attacks.

Haspel, who has spent 33 years at the CIA, had served as the agency's director since February 2017 and as acting director for several weeks. Earlier in her career, after 9/11, she ran a CIA black site in Thailand where U.S. officials have previously told NBC News an al Qaeda detainee, allegedly the mastermind of the USS Cole bombing, was waterboarded three times and confined to a small box. Haspel later drafted a cable ordering that videotapes of CIA interrogations be destroyed. Her precise role is classified to the public.

In her recent testimony, Haspel argued that the tapes were destroyed because she was following orders from her superior and that there was concern at the agency about the security risks the tapes posed to CIA officers who appeared in them.

Sen. John McCain, R-Ariz., who was tortured as a prisoner of war during the Vietnam War, was among the few Republicans who came out against Haspel. McCain, who has been absent from Capitol Hill this year as a result of cancer treatment, announced his opposition in a recent statement.

"I believe Gina Haspel is a patriot who loves our country and has devoted her professional life to its service and defense,” McCain said. “However, Ms. Haspel’s role in overseeing the use of torture by Americans is disturbing. Her refusal to acknowledge torture’s immorality is disqualifying. I believe the Senate should exercise its duty of advice and consent and reject this nomination."