IRBIL, Iraq — The Egyptian government said Monday that it had bombed Islamist targets throughout Libya to retaliate for the beheading of 21 Coptic Christians whose murders on a beach apparently near Tripoli were recorded and posted Sunday on the Internet.

The beheading of the Egyptian Christians and the swift Egyptian retaliation further tangled Libya’s power struggle where two governments rule, one in Tripoli, the country’s capital, and one in Tobruk, near Libya’s border with Egypt. Militias, some with ties to al-Qaida and the Islamic State, operate without challenge throughout the country.

While the video claimed the Egyptian workers were killed near Tripoli, in the country’s west, Egyptian airstrikes appeared primarily to hit targets in the eastern city of Derna, where the Islamic State first declared its presence in November.

Among the targets, according to the English-language Libya Herald website, were Islamic State training bases south of the city and the home of Bashar al Drissi, one of the Islamic State’s leaders in Libya.

The news site also reported fresh kidnappings of Egyptians inside Libya, saying as many as 35 were reported detained in the aftermath of the Egyptian bombings.

The Libyan air force, which is loyal to the government in Tobruk, which also is recognized by the United States and the United Kingdom, warned supporters of the Tripoli government to stay away from likely targets. It was uncertain whether Libyan planes had played a role in Monday’s attacks.

The government in Tripoli, while denouncing the beheadings as “heinous crimes,” condemned the airstrikes, the Libya Herald reported.

Also unclear was whether the murders and the Egyptian response would encourage the United States or Europe to intervene more aggressively in Libya.

The United States evacuated its embassy in Tripoli last July, and European countries have abandoned their posts there as well. Italy, which once oversaw Libya as a colonial power, closed its embassy Sunday.

The United States, in condemning the beheadings, seemed to indicate it was unlikely to see them as a reason to expand its military campaign against the Islamic State to Libya.

While saying the killings “only further galvanizes the international community to unite against ISIL,” the statement called for “a political resolution to the conflict in Libya, the continuation of which only benefits terrorist groups.” ISIL and ISIS are acronyms for the Islamic State.

“We continue to strongly support the efforts of the United Nations Special Representative of the Secretary-General, Bernardino Leon, to facilitate formation of a national unity government and help foster a political solution in Libya,” the statement said.

There was no immediate U.S. response to the Egyptian air raids Monday, a holiday in the United States, and they were not directly addressed in a briefing with reporters in advance of a White House conference beginning Tuesday on how to counter violent extremism.

“To be clear, countering violent extremism is only one element of all of the different tools we’re bringing against terrorists and specifically groups like ISIL,” a senior administration official said.

Said another senior administration official: “The summit is a complement to, not a replacement of, efforts to counter ISIL.”

The murdered Copts were some of the thousands of Egyptians who have come to work in Libya’s oil-rich but manpower poor economy and had been taken hostage in December and January.

The Egyptian government, in an announcement on state-run television, said it had conducted “retribution and response to the criminal acts of terrorist elements and organizations inside and outside the country.”

The 21 hostages appeared to include about 20 Coptic Christian Egyptian guest workers kidnapped from in and around the Libyan city of Sirte in two separate abductions.

Thousands of Egyptians and African guest workers work in Libya, a nation with 2 percent of the world’s oil reserves and a population of just 6 million.

Despite widespread domestic poverty, most manual labor in Libya is performed by foreign workers.

The video posted Sunday night bore the logo of the media arm of the Islamic State, which occupies portions of Syria and Iraq, and suggested that ties between the group in those countries and those who have claimed allegiance to it in Libya were closer than had been previously suspected.

Groups in Afghanistan, Egypt, Pakistan and Yemen have also claimed allegiance to the Islamic State.