TRIPOLI/BAGHDAD - US warplanes carried out air strikes against Islamic State-linked militants in western Libya on Friday, killing as many as 40 people in an operation targeting a suspect linked to two deadly attacks last year in neighbouring Tunisia.

It was the second US air strike in three months against Islamic State in Libya, where the hardline Islamist militants have exploited years of chaos following Muammar Gaddafi's 2011 overthrow to build up a presence on the southern shores of the Mediterranean Sea.

The Pentagon said it had targeted an Islamic State training camp and killed a Tunisian militant linked to major attacks on tourists in Tunisia.

The mayor of the Libyan city of Sabratha, Hussein al-Thwadi, told Reuters the planes struck at 3:30 a.m. (0130 GMT), hitting a building in the city's Qasr Talil district, home to many foreigners. He said 41 people had been killed and six wounded. The death toll could not immediately be confirmed with other officials. Photos released by the municipal authorities showed a massive crater in grey earth. Several wounded men lay bandaged in hospital.

The air strikes targeted a house in a residential district about 8 km (5 miles) west of the centre, the municipal authorities said in a statement.

The house had been rented to foreigners including Tunisians suspected of belonging to Islamic State, and medium-calibre weapons including machineguns and rocket-propelled grenades had been found in the rubble, the statement said.

Tunisian security sources have said they believe Tunisian Islamic State fighters have been trained in camps near Sabratha, which is close to the Tunisian border.

Among those Washington said it targeted in the air strikes was Noureddine Chouchane, a Tunisian blamed by his native country for attacks last year on a Tunis museum and the Sousse beach resort, which killed dozens of tourists.

"Destruction of the camp and Chouchane's removal will eliminate an experienced facilitator and is expected to have an immediate impact on ISIL's ability to facilitate its activities in Libya, including recruiting new ISIL members, establishing bases in Libya, and potentially planning external attacks on US interests in the region," the Pentagon said, using an acronym for Islamic State, also known as ISIS or Daesh.

The air strikes came just days after a warning by President Barack Obama that Washington intended to "take actions where we've got a clear operation and a clear target in mind". "And we are working with our coalition partners to make sure that as we see opportunities to prevent ISIS from digging in, in Libya, we take them," Obama said on Tuesday.

Britain said it had authorised the use of its airbases to launch the attack. "I welcome this strike that has taken out a Daesh training camp being used to train terrorists to carry out attacks," Defence Secretary Michael Fallon said in a statement. "I was satisfied that its destruction makes us all safer, and I personally authorised the US use of our bases."

Islamic State runs a self-styled caliphate across swathes of Iraq and Syria, where it has faced air strikes from a US-led coalition since 2014.

Thwadi, the Sabratha mayor, said some Tunisians, a Jordanian and two women were among the dead, and several Tunisians who had recently arrived in Sabratha were among survivors. He gave no further details.

Since Gaddafi was overthrown five years ago by rebel forces backed by a campaign of NATO air strikes, Libya has slipped deeper into chaos, with two rival governments each backed by competing factions of former rebel brigades.

A UN-backed government of national accord is trying to win support, but is still awaiting parliamentary approval. It is opposed by factional hardliners and has yet to establish itself in the capital Tripoli.

Meanwhile, Islamic State has expanded, attacking oil ports and taking over Gaddafi's home city of Sirte, now the militant group's most important stronghold outside its main redoubts in Syria and Iraq.

Calls have increased for a swift Western response to stop the group establishing itself more permanently and using Libya as a base for attacks on neighbours Tunisia and Egypt.

Western officials and diplomats have said air strikes and special forces operations are possible as well as an Italian-led "security stabilisation" plan of training and advising.

US and European officials have in the past insisted Libyans must first form a united government and ask for help, but they also say they may still carry out unilateral action if needed.

Last November the United States said it carried out an air strike on Derna, a town on the opposite side of Libya close to the Egyptian border, to target Abu Nabil, also known as Wissam Najm Abd Zayd al Zubaydi, an Iraqi commander in Islamic State.

Last June, a US air strike targeted veteran Algerian militant Mokhtar Belmokhtar and other militants meeting in the eastern Libyan city of Ajdabiya. His fate is unclear.

Meanwhile, rare clashes erupted Friday inside the militant stronghold of Fallujah, west of Baghdad, between the Islamic State group and Iraqi tribesmen, officials and a tribal leader said.

The shootout pitted fighters from multiple tribes against IS members known as Al-Hisba, who are responsible for enforcing religious strictures in the city, sources said.

"Clashes took place between sons of the Al-Mahamda and Al-Juraisat tribes against the Al-Hisba group," Issa Sayir, the exiled official responsible for the Fallujah area, told AFP.

Sayir said the gunfight reflected tensions resulting from increasingly difficult living conditions caused by Fallujah's isolation by the security forces.

A police lieutenant colonel gave a different account, saying the clashes started after Al-Hisba members accused a woman in Al-Nizaiza market in central Fallujah of misconduct because she had failed to cover her hands with gloves.

The officer said that members of a third tribe, Al-Halabsa, were also involved in the clashes against IS, and that sporadic fighting was ongoing.

Sheikh Majeed al-Juraisi, a leader in the Al-Juraisat tribe, described the clashes as an uprising against IS in the city and called on the government and security forces to help residents who are fighting the militants.

Tribesmen have seized part of Al-Jolan, an area in northwest Fallujah, Juraisi said.

The Iraqi interior ministry also issued a statement on the fighting, saying that tribesmen had seized parts of Al-Jolan and its outskirts but that IS later regained control.

Citing intelligence information, the ministry said the clashes began as a fight between members of the Al-Juraisat tribe and the Al-Hisba in Al-Nizaiza market.

The fight escalated into a shootout in which light and medium weapons were used, and Al-Mahamda and Al-Halabsa tribesmen backed Al-Juraisat fighters.

Fallujah, which is located about 50 kilometres (30 miles) west of Baghdad, has been held by anti-government forces since the beginning of 2014, and is now one of two Iraqi cities still under IS control.

IS launched a sweeping offensive in June 2014 that overran large areas north and west of Baghdad, but security forces and allied fighters have pushed the militants back with support from US-led air strikes.