Militants claiming loyalty to Islamic State killed 42 people in suicide car bombings in eastern Libya on Friday, in apparent retaliation for Egyptian air strikes.

The three car bombs exploded in Qubbah, a small town near the seat of the official government in what appeared to be another high profile attack by the group after the storming of a Tripoli hotel and the killing of 21 captive Egyptian Copts.

On Monday, Egyptian air force jets bombed Islamic State targets in Derna in far eastern Libya, after the ultra-radical group released a video showing the Coptic Christian migrant workers being decapitated on a beach.

"They killed and wounded tens in revenge for the bloodshed of Muslims in the city of Derna," said a statement issued by the "Islamic State, Cyrenaica province". It could not be verified by Reuters but this group has issued statements before which were not subsequently contested by others.

Bombs before prayers

The bombs exploded shortly before Friday prayers at a petrol station, the local security headquarters and the town council in Qubbah, home town of Parliamentary Speaker Aguila Saleh, security officials said. His house is close to the town council, but he was out of town at the time.

Forty-two people were killed, among them five Egyptian workers, and 70 people were wounded, security officials and medics said.

Four years after rebels overthrew Moammar Gaddafi, the oil-producing North African state is in chaos, with two governments and parliaments allied to armed factions fighting for control, while Islamist groups exploit the power vacuum.

Previous suicide and car bomb attacks, mainly in the east of Libya, have tended to target police and army bases rather than civilians, with security officials blaming Islamist groups such as Ansar al-Sharia which are believed to have links with militants claiming allegiance to Islamic State.

"We are announcing seven days of mourning for the victims of Qubbah," Saleh told Al Arabiya television. "I think this operation was revenge for what happened in Derna," he said without elaborating.

"We are announcing seven days of mourning for the victims of Qubbah," Saleh told Al Arabiya television. "I think this operation was revenge for what happened in Derna."

Hours after the attacks, troops loyal to the official government used military helicopters to attack militant targets in Derna, a military source said.

Government spread out

War planes also attacked forces loyal to the rival government in Ben Jawad, said Ali al-Hassi, a military spokesman. The area is a launchpad for rival forces which have been trying to take the Es Sider oil port.

The internationally recognized prime minister, Abdullah al-Thinni, is based in Bayda, some 40 km from Qubbah. Saleh works out of Tobruk, another eastern town now home to the House of Representatives, the elected parliament.

The capital Tripoli in the far west is under the control of a rival government and parliament, set up after a faction called Libya Dawn seized the city in summer, forcing Thinni to flee to the east.

Last month, militants claiming affiliation with Islamic State stormed the Corinthia luxury hotel in Tripoli, killing five foreigners and at least four Libyans.

Supporters of the group, which has seized large areas of Iraq and Syria, have also taken over government and university buildings in Sirte, a central city and birthplace of Gaddafi, according to residents.