TRIPOLI, Libya -- Islamic State militants unleashed suicide bombings Friday in eastern Libya, killing at least 40 people in what the group said was retaliation for Egyptian airstrikes against the extremists' aggressive new branch in North Africa.

The bombings in the town of Qubba, which is controlled by Libya's internationally recognized government, solidified concerns the extremist group has spread beyond the battlefields of Iraq and Syria and established a foothold less than 500 miles from the southern tip of Italy.

The militants have taken over at least two Libyan coastal cities on the Mediterranean -- Sirte and Darna, which is about 30 kilometres from Qubba. They released a video Sunday that showed the beheading of 21 Egyptian Christians who were abducted in Sirte, and Egypt responded Monday with airstrikes on Darna.

The Islamic State group has established its presence in Libya by exploiting the country's breakdown since dictator Moammar Gadhafi was ousted and killed in 2011. Hundreds of militias have taken power since then, and some of them have militant ideologies. A militia coalition known as Libya Dawn has taken over Tripoli, where Islamists set up their own parliament and government. Islamic extremist militias controlled the second-largest city of Benghazi until late last year, when army troops began battling them for control.

The Islamic State group claimed responsibility for Friday's suicide bombings in Qubba, but said there were only two attacks, while the government said there were three.

Army spokesman Mohammed Hegazi said one attacker rammed an explosives-packed ambulance into a gas station where motorists were lined up.

"Imagine a car packed with a large amount of explosives striking a gas station; the explosion was huge and many of the injured are in very bad shape while the victims' bodies were torn into pieces," Hegazi said.

Two other bombers detonated vehicles next to the house of the parliament speaker and the nearby security headquarters, he said.

Government spokesman Mohammed Bazaza put the death toll at 40, with at least 70 injured, some seriously. The number of dead was expected to rise. Two security officials, speaking on condition of anonymity becase they were not authorized to talk to the media said at least 45 were killed.

Among the dead were six Egyptians working at a cafe next to the gas station.

Video broadcast from the scene showed dozens of cars wrecked and ablaze, with pools of blood on the asphalt, along with body parts, shoes and shattered glass. Bodies covered in sheets were lined up nearby. The government and parliament announced a week of mourning.

"This terrorist, cowardly and desperate attack only increases our determination to uproot terrorism in Libya and in the region," Bazaza said, adding that Libyan air force jets conducted several airstrikes, without specifying where.

Witnesses in the city of Sirte said it was hit by multiple Libyan airstrikes Friday, targeting a convention centre that is used as a headquarters by the Islamic State group.

U.S. State Department spokeswoman Jen Psaki said Washington condemned the attacks in Qubba.

In addition to launching airstrikes on Darna earlier this week, Egypt joined Libya's elected government in pressing for a U.N. Security Council resolution to lift a U.N. arms embargo on Libya and pave the way for international intervention -- similar to the U.S.-led campaign in Syria and Iraq against the Islamic State group.

But Security Council members U.S. and Britain rejected the call, saying Thursday that Libya needs a national unity government first.

Bazaza repeated an appeal for lifting the arms embargo.

Libya is split between two rival parliaments and governments. The elected and internationally recognized parliament has been forced to relocate to the eastern city of Tobruk near the Egyptian border because Tripoli has been overrun by the Islamic and tribal militias. Meanwhile, an older pre-election parliament, supported by the militias, has remained in Tripoli and declared itself legitimate.

As violence has escalated dramatically across the country since summer, hundreds of thousands of Libyans have been displaced and entire cities and towns have been left in ruins. Islamic militias, including extremists from the Islamic State, are battling government forces for control of Benghazi in eastern Libya.

The Tripoli-based government, which is partially supported by Islamist factions and militias from the western city of Misrata, continued to deny the presence of an Islamic State affiliate in Libya. In a speech Thursday, Omar al-Hassi, the chosen prime minister of the Tripoli government, blamed the recent violence on Gadhafi loyalists and said the beheading video was "fabricated."

However al-Hassi also urged Egyptians to leave the country, saying that authorities can't ensure their safety.