US special forces have carried out two separate raids in Africa targeting senior Islamist militants, American officials say.
Anas al-Libi was seized in the capital Tripoli.
And a leader of the al-Shabab group was targeted in southern Somalia, but that raid appears to have failed.
The al-Shabab leader – who has not been identified – is suspected of involvement in last month’s attack in the Westgate shopping centre in Kenya’s capital Nairobi, which left at least 67 people dead.
Anas al-Libi’s relatives and US officials said he had been seized in the Libyan capital early on Saturday.
He was parking outside his house when three vehicles encircled him, his car’s window was smashed and his gun was seized before he was taken away, his brother Nabih was quoted as saying by AP.
He added that Libi’s wife also saw the attack, describing the abductors as foreign-looking “commandos”.
The raid was conducted with the knowledge of the Libyan government, a US official was quoted as saying by CNN.
Libi “is currently lawfully detained by the US military in a secure location outside of Libya”, Pentagon spokesman George Little said.
The 49-year-old is believed to have been one of the masterminds behind the 1998 US embassy attacks, which killed more than 220 people in Kenya and Tanzania.
He has been indicted in a New York court in connection with the attacks.
Libi – whose real name is Nazih Abdul-Hamed al-Ruqai – has been on the FBI’s most wanted list for more than a decade with a $5m (£3.1m) bounty on his head.
Meanwhile, the US defence department confirmed that special forces had carried out a seaborne operation in Somalia’s coastal town of Barawe.
Mr Little said the forces “were involved in a counter-terrorism operation against a known al-Shabab terrorist”. He declined to provide any further details.
However, the officials later said that the Seals failed to find the intended target, who was not identified.
The raid was carried out by members of Seal Team Six – the same unit that killed bin Laden, a US military official told AP.
The official added that in Barawe the commandos had decided to abort the mission after encountering fierce resistance from al-Shabab fighters.
“The Barawe raid was planned a week and a half ago,” a US security official told the New York Times.
“It was prompted by the Westgate attack,” added the official, who was speaking on the condition of anonymity.
Al-Shabab earlier told the BBC that “white soldiers” had arrived by boat in Barawe and rebels had repulsed them, losing a fighter.
Local group commander Mohamed Abu Suleiman said the raid had failed and the group remained in control of Barawe.
Both Britain and Turkey deny al-Shabab claims that their forces were involved in the operation.
Barawe residents said say they were woken up by heavy fighting before dawn.
“Gunfire broke out for about 10-15 minutes,” an eyewitness told AFP news agency.
Al-Shabab has said it carried out the attack in the Westgate shopping centre in Nairobi on 21 September.