WASHINGTON (AP) -- The Senate has confirmed Gina Haspel as the first female director of the CIA following a rocky nomination process that reopened debate about one of the darkest chapters in the spy agency's history.

Thursday's vote was 54-45. Republican John McCain was absent.

Haspel's nomination was contentious because of her role in a former CIA program to brutally detain and interrogate terror suspects at covert sites abroad following Sept. 11.

Her opponents said it wasn't right to promote someone who supervised a black site in Thailand. They said the U.S. needs to close the book forever on the program that marred America's image with allies abroad.

Haspel's supporters cited her 33-year career at the agency. Former top intelligence officials said she earned the chance to take the helm of the intelligence agency.

Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.