US special forces have carried out two separate raids in Africa targeting senior Islamist militants, American officials say.
In Libya, US commandos captured an al-Qaeda leader accused of the 1998 bombings of the US embassies in Kenya and Tanzania.
Anas al-Liby 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.
Al-Shabab has said it carried out the attack on 21 September.
US Secretary of State John Kerry said the operations in Libya and Somalia showed that the US would never stop "in its effort to hold those accountable who conduct acts of terror".
Those who attacked American interests "can run but they can't hide", he told reporters in Indonesia where he is attending an Asian summit.
Anas al-Liby'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 Liby'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.
Liby "is currently lawfully detained by the US military in a secure location outside of Libya", Pentagon spokesman George Little said.
For its part, Libya said it had contacted the US authorities to demand an explanation" as soon as it heard the reports", according to a government statement.
It also expressed hope that its "strategic partnership" with the US would not be damaged by the incident.
Liby, 49, 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.
Liby - 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.
Al-Qaeda's leadership has been consistently targeted since the killing of Osama Bin Laden by US special forces in 2011 in Pakistan.
The US defence department has also confirmed that special forces carried out a seaborne operation in Somalia's coastal town of Barawe on Saturday.
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.
Initial reports in the US media quoted unnamed US officials as saying that the suspect had been captured or killed by US Navy Seals in the pre-dawn raid on a villa.
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.