Militants from the Islamic State group who were killed in a US air strike in Libya posed a threat to US and Western interests, the Pentagon says.
An IS camp was attacked in Sabratha, around 70km (43 miles) west of Tripoli.
The 38 people killed reportedly include Tunisian extremist Noureddine Chouchane, linked to two attacks in Tunisia last year, including one which killed 30 Britons.
The IS group has been active in Libya for more than a year.
The US estimates the group has up to 6,000 fighters there.
Pentagon spokesman Peter Cook said the strike was carried out "with the knowledge of Libyan authorities" but declined to confirm exactly who had been informed.
"We took this action against Sabir [Noureddine Chouchan] in the training camp after determining that both he and the ISIL [IS] fighters at these facilities were planning external attacks on US and other Western interests in the region," he was quoted by AFP news agency as saying.
"We see what's happening in Iraq and Syria and we believe that these fighters in Libya posed a threat to our national security interests."
Libya remains in chaos more than four years after the overthrow of former leader Muammar Gaddafi and is being fought over by a number of groups, including IS.
Efforts to agree on a unified government have so far been unsuccessful, with different authorities governing different parts of the country.
The Pentagon described Chouchane as an "experienced facilitator" who had helped move IS fighters across the Tunisia-Libya border.
American F-15E fighters as well as unmanned aircraft were involved in the raid, the Pentagon said.
The BBC understands that British bases were involved in the attack but no British assets, such as warplanes, were involved.
The mayor of Sabratha put the death toll at 41 and said the majority of those killed were Tunisians.
A statement on the council website said weapons such as machine-guns and rocket-propelled grenades had been found at the site.
In November, a US strike in Derna reportedly killed Iraqi IS commander Abu Nabil, also known as Wissam Najm Abd Zayd al-Zubaydi, who was said to be the group's leader in Libya.
The US has launched several unilateral raids and operations in the country since it helped oust Gaddafi.
In June, a gun attack in the Tunisian resort town of Sousse left 38 people dead, 30 of them Britons.
Chouchane is also believed to have been behind the attack on the Bardo Museum in Tunis last year, which left 19 people dead.
The gunmen in both the Sousse and Bardo attacks are believed to have trained in Libya, which shares a border with Tunisia.
Islamic State militants in Libya
- IS jihadists seized a strip of land along Libya's coast, around the city of Sirte, last year
- Libyan intelligence officials say foreign fighters and some IS commanders have relocated there from Iraq and Syria
- The US estimates the number of IS foreign jihadists at 4,000-6,000
- The largest groups are said to be from Tunisia, Egypt, Sudan and Iraq
- Recent recruitment has focused on sub-Saharan African countries
- It is not known how many of the jihadists are nationals of European countries
- IS militants have attacked Libyan cities, including Tripoli and Benghazi, and oil installations