WASHINGTON (Reuters) - The U.S. Senate confirmed Gina Haspel on Thursday to be director of the CIA, ending a bruising confirmation fight centered on her ties to the spy agency’s past use of waterboarding and other brutal interrogation techniques.

Haspel, who will be the first woman to lead the CIA, is a 33-year veteran at the agency currently serving as its acting director. The tally was 54-45 in favor of her nomination in the 100-member chamber, where a simple majority was required for confirmation.

Six Democrats joined President Donald Trump’s fellow Republicans in voting for Haspel, and two Republicans voted no.

Haspel was approved despite stiff opposition over her links to the CIA’s use of harsh interrogation methods, including waterboarding, a type of simulated drowning widely considered torture, in the years after the Sept. 11 attacks.

An undercover officer for most of her CIA career, Haspel in 2002 served as CIA station chief in Thailand, where the agency conducted interrogations at a secret prison using methods including waterboarding. Three years later, she drafted a cable ordering the destruction of videotapes of those interrogations.

Republican Senator John McCain, who has been away from Washington all year as he battles brain cancer, urged the Senate not to vote for Haspel. He did not vote on Thursday.

Tortured himself while a prisoner of war in Vietnam, McCain said approving Haspel would send the wrong message, and the country should only use methods to keep itself safe “as right and just as the values we aspire to live up to and promote in the world.”

Haspel also had strong support from Trump’s administration, many current and former intelligence officials and a wide range of lawmakers, including Democrats.

Senator Mark Warner, the top Democrat on the Intelligence Committee, which oversaw the nomination, supported Haspel.

“I believe she is someone who can and will stand up to the president, who will speak truth to power if this president orders her to do something illegal or immoral, like a return to torture,” he said in a Senate speech before the vote.

Rights groups quickly condemned the vote. Laura Pitter of Human Rights Watch called it “the predictable and perverse byproduct of the U.S. failure to grapple with past abuses.”

Trump nominated Haspel, then deputy director, in March to succeed Mike Pompeo as CIA director. Haspel became acting director after Pompeo was confirmed as secretary of state.