Abdullah al-Senussi, 62, was also Gadhafi's brother-in-law and one of the Libyan dictator's most trusted henchmen before the Tripoli regime's downfall in August 2011 after an eight-month revolution.
Senussi was privy to many of Gadhafi's secrets, which could prove embarrassing for the United States, Britain, France and other countries that had clandestine dealings with Gadhafi's regime during his 42-year rule.
Senussi was arrested Friday in Mauritania after flying into Nouakchott aboard a Royal Air Maroc flight from Morocco. He was allegedly carrying a fake Malian passport.
The Libyans said Tuesday that Mauritania had agreed to extradite Senussi to Tripoli.
But if that's the case, it will thrust Libya, struggling with post-Gadhafi chaos, into conflict with the International Criminal Court and France, both of which also want Senussi.
He had been on the run since Gadhafi's regime toppled. He was able to flee Libya and was the subject of a Red Notice issued in September by the International Criminal Court for crimes against humanity. Mauritania, however, isn't a signatory the Rome Statute governing the ICC.
Libya's interim government issued an arrest warrant for him after Gadhafi's government fell. Tripoli demanded Senussi's extradition as soon as his capture was announced and insisted he'd get a fair trial.
Senussi, part of Gadhafi's inner circle, known as "ahl al-Khaimah," the people of the tent, had a fearsome reputation for brutality. He was widely hated and feared during Gadhafi's rule and was suspected of many atrocities within Libya.
Among these is the slaughter of more than 1,200 inmates, including Islamist opponents linked to al-Qaida, in Tripoli's notorious Abu Salim prison in 1996.
It was the arrest of a lawyer for victims' relatives that triggered the Libyan revolt against Gadhafi in February 2011.
"Senussi is Gadhafi's black box," observed one Libyan official in the National Transition Council, the ousted regime's successor. "He has lots of information and knows all the secrets. He must be put on trial here."
France also wants Senussi and demanded his extradition, claiming it played a role, unspecified but probably involving its foreign intelligence service, in his capture. The French led Western backing for the uprising that brought Gadhafi down.
Senussi was convicted in absentia, along with several other Libyans, to life imprisonment by a French court in 1999 for his role in the bombing of a French UTA DC-10 airliner over the Sahara Desert in Niger Sept. 19, 1989.
All 170 people, 54 of them French citizens, aboard the wide-body jet were killed when a suitcase bomb exploded at 35,000 feet during a flight from N'Djamena, Chad, to Paris.
Libya doggedly denied involvement in the UTA bombings and refused to extradite Senussi and his co-defendants. But in 2004, as Gadhafi was seeking to cast off his role as an international pariah, he agreed to pay $170 million to the victims' families
Meantime, the Americans have told Mauritania they want a crack at Senussi before he's handed over.
Gadhafi's former right-hand man has detailed knowledge of the dictator's clandestine operations and his links to terrorist organizations, including the bombing of Pan Am Flight 103 over Scotland Dec. 21, 1988.
U.S. and British intelligence services have long laid that attack at Gadhafi's door since at the time he was accused of sponsoring terrorism against the West.
All 259 passengers and crew aboard the Boeing 747, including 178 Americans and 31 Britons, were killed when it blew up at 31,000 feet over the town of Lockerbie. Another 11 people were killed on the ground.
Libya denied involvement. But two Libyan intelligence agents were put in trial at a special court in the Netherlands. One, Abdel Basit al-Megrahi, was convicted and sentenced to life imprisonment in Scotland.
He claims he's innocent and was released Aug. 20, 2009, after being diagnosed with terminal cancer. He returned to Tripoli to a hero's welcome.
Senussi, as head of Libya's external intelligence organization at the time, could have important information about the incident.
Martin Bashir resigns from MSNBC over Sarah Palin comments
Toddler uninjured after being knocked over by Obama family dog