Veteran spy Gina Haspel will become the first female director of the CIA after six Democrats joined Republicans in a Senate confirmation vote that overrode concerns about her role in the spy agency's harsh interrogation program after 9/11.

Thursday's 54-45 vote split both parties, and the margin was the closest for a CIA nominee in the nearly seven decades that a nod from the Senate has been required. Haspel, who has spent nearly all of her 33-year CIA career in undercover positions, is the first career operations officer to be confirmed since William Colby in 1973.

Haspel, 61, is a native of Kentucky but grew up around the world as the daughter of an Air Force serviceman. She worked in Africa, Europe and classified locations around the globe and was tapped as deputy director of the CIA last year. She worked under former CIA director Mike Pompeo until President Donald Trump moved him to secretary of state.

Haspel was backed by many in the CIA rank-and-file and was robustly supported by senior intelligence officials, including six former CIA directors and three former national intelligence directors, who said she earned the chance to take the helm of the nation's premier spy agency. National Intelligence Director Dan Coats said Haspel has integrity and both frontline and executive intelligence expertise. "We salute Director Haspel, a trailblazer who today becomes the first woman to lead the CIA," he said.

Her opponents argued that it wasn't right to promote someone who supervised a covert detention site in Thailand where terror suspects were waterboarded, an interrogation technique that simulates drowning. They said the U.S. needed to slam closed what was one of the CIA's darkest chapters that tainted America's image with allies abroad.

Several senators said Haspel was not forthcoming in answering questions about her role in the torture program or the CIA's decision to destroy video-taped evidence of the sessions. They also had questions about her rejection of the now-banned techniques.

Sen. Ron Wyden, D-Ore., said in a floor speech that Haspel "offered up almost the classic Washington non-apology." He asked how the Senate could take seriously Haspel's "conversion on torture?"

Sen. Patrick Leahy, D-Vt., said the world was watching the confirmation vote, which he called a "referendum on torture." He said the so-called "enhanced interrogation techniques" the CIA used at black sites, including slamming detainees against walls and confining them in coffin-shaped boxes, amounted to "government-sanctioned torture."

Haspel has vowed never to restart such a program and says her "strong moral compass" would prevent her from carrying out any presidential order she found objectionable. That was enough to coax some senators into the "yes" column. But Leahy said he still questioned her judgment and lamented that she has never publicly condemned torture as "immoral."

He wondered aloud what Haspel would do if she's asked to do something that goes against America's core values. "Should we trust that she will have the moral compass to stand up and say 'No?'" he asked. "Based on what we've seen, I do not."

Sen. Dianne Feinstein, D-Calif., said the nomination was not just about Haspel, but the U.S. grappling with its past mistakes.

"The bottom line is this: No one has ever been held accountable for the torture program and I do not believe those who were intimately involved in it deserve to lead the agency," Feinstein said before casting her vote against Haspel.

Since Trump nominated Haspel, her confirmation has been clouded by debate over the CIA's former interrogation program. A protester in the Senate visitor gallery briefly disrupted speeches ahead of the vote with shouts against the CIA.

Three Republicans opposed her: Sen. John McCain of Arizona, who is battling cancer and did not vote; Sen. Rand Paul of Kentucky; and Sen. Jeff Flake of Arizona.

Six Democrats, however, were heartened by her pledge to never restart harsh interrogation programs, even if Trump requested. They said they voted for Haspel because they thought her experience was essential in confronting today's threats from U.S. adversaries like Russia, North Korea, China and Iran.

Among Democrats supporting Haspel were several up for re-election this fall in states where Trump is popular, including Sen. Joe Manchin of West Virginia, Sen. Heidi Heitkamp of North Dakota, Sen. Joe Donnelly of Indiana and Sen. Bill Nelson in Florida. Also voting yes were Sen. Jeanne Shaheen of New Hampshire and Sen. Mark Warner of Virginia, the ranking member of the intelligence committee.

"This has not been an easy decision," Warner said, adding that he'd met and talked with Haspel many times in the past several weeks. He said he's convinced that Haspel could and would stand up to Trump, who has voiced support for waterboarding and has said "torture works."

After the vote, human rights groups quickly issued statements denouncing the confirmation and the now-defunct program.

"The Senate has now rewarded that atrocious conduct by promoting someone that reportedly administered it to lead one of the government's most powerful agencies," said Daphne Eviatar at Amnesty International USA.