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. Six Democrats voted in favor of Haspel including several who face tough re-election races in November: Joe Donnelly of Indiana, Heidi Heitkamp of North Dakota, Joe Manchin of West Virginia and Bill Nelson of Florida. The other two were Sen. Mark Warner of Virginia, ranking member of the Senate Intelligence Committee, and Sen. Jeanne Shaheen of New Hampshire.

Two Republicans voted against Haspel — Jeff Flake of Arizona and Rand Paul of Kentucky.

Sen. John McCain, R-Ariz., in his home state for cancer treatment, did not vote. The Arizona senator, who was tortured as a prisoner of war during the Vietnam War, was among the few Republicans who came out against Haspel, announcing his opposition in a recent statement.

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.