The CIA has a new boss, and for the first time, it's a woman.

On Thursday afternoon, despite vocal opposition from many senators over her involvement in the Bush-era "enhanced interrogation", i.e. torture, programs, the Senate confirmed Gina Haspel in a 54-45 vote as the next head of the CIA.

In the end, support from Senate Democrats, including the Senate Intelligence Committee's vice chair Mark Warner, helped ensure Haspel's confirmation. She was previously approved by the Senate Intelligence Committee in a 10-5 vote early Wednesday in a closed-door session, paving the way for her confirmation.

While close, this was not the narrowest of Trump nominee confirmations, with Betsy De Vos, Jeff Sessions and Scott Pruit all confirmed with a narrower margin.

Haspel's 54-45 confirmation vote not the narrowest of Trump nominees: @BetsyDeVosED was confirmed 51-50, with @VP casting tie-breaking vote. Other narrow confirmation votes: -AG Sessions: 52-47 -@EPAScottPruitt 52-46

“Throughout the process, she demonstrated candor, integrity and a forthright approach to the committee's questions. She displayed the talent and expertise that make her uniquely qualified to face America’s biggest national security challenges, whether in the area of counterterrorism or renewed international competition among great powers,” Senate Majority Leader Mitch McConnell said ahead of Thursday's vote.

Many disagreed: Republican Senators Rand Paul (Ky.) and Jeff Flake (Ariz.) sided with most Democrats in voting against Trump's controversial pick to replace Mike Pompeo. Sen. John McCain also opposed her nomination but was in Arizona battling brain cancer. Meanwhile, several Democrats including Sen. Mark Warner (Va.), the vice chairman of the Intelligence Committee, and red-state Democratic Sens. Joe Donnelly (Ind.), Joe Manchin (W.Va.) and Heidi Heitkamp (N.D.) supported the nominee.

While Haspel's nomination sparked renewed debate over brutal interrogation practices the CIA used on terror suspects after 9/11 mostly due to her involvement in supervising a secret CIA detention site in Thailand, it wasn't enough to prevent her from becoming the next CIA head. Still, the veteran CIA official who has been with the agency for more than 30 years, received roughly half the support from Democrats that now-Secretary of State Mike Pompeo, a former House member, received last year when he was confirmed as President Trump’s first CIA chief.

Her nomination was immersed almost immediately by controversy because of her involvement in the agency’s post-Sept. 11 “enhanced interrogation” program — now widely viewed as torture. In particular, senators homed in on her time spent running a CIA black site and role in the destruction of videotapes documenting the interrogation of an al Qaeda suspect.

Meanwhile, as the Hill details, the CIA - and Trump - launched an all-out charm offensive in order to build support for Haspel's nomination, playing up politically favorable aspects of her largely secret career, including her work on Russia. They also touted her support among former intelligence community officials, including James Clapper, former President Obama’s director of national intelligence.

In the end the deep state got what it wanted.