The body of a Somali refugee, killed in an attack on a boat off the coast of Yemen, is carried at the Red Sea port of Hodeida, Yemen, on March 17. (Abduljabbar Zeyad/Reuters)

An apparent military strike targeted a boat carrying Somali refugees off the coast of war-battered Yemen, killing dozens of people along a dangerous migrant route that leads to Libya and to smuggling ships heading to Europe, U.N. and Yemeni officials said Friday.

It was not immediately clear who carried out the attack early Friday, which caused heavy loss of life among Somalis who first came to Yemen to escape violence in their homeland.

Two security officials in the Yemeni capital, which is controlled by Houthi rebels battling a Saudi-led coalition, said the attack was carried out by a coalition Apache helicopter. The claim could not immediately be confirmed.

Yemeni and U.N. officials said more than 40 people were killed and about 80 injured, adding that the death toll could rise.

Mohammed Abdiker, emergencies director at the Geneva-based International Organization for Migration (IOM), said 42 bodies were recovered from the narrow channel at the mouth of the Red Sea. Abdiker said there were “conflicting messages” on whether the refu­gee boat was targeted by a warship or an attack helicopter.

Belongings of Somali refugees killed in an attack off the coast of Yemen lie scattered on a boat in the western Yemeni city of Hodeida on March 17. (Zahir Mohamed/European Pressphoto Agency)

A Pentagon spokesman, Adam Stump, said Friday that no U.S. aircraft were involved in the reported attack. Saudi Arabia and the United Arab Emirates operate U.S.-manufactured Apache helicopters in the Yemeni theater.

The Saudi-led coalition fighting in Yemen has said that Shiite Houthi rebels use the Red Sea strait to smuggle weapons into the country, which has been devastated by years of warfare.

Images showed bodies strewn on the ground at the port of Hodeida in western Yemen, their faces covered with blankets. Abdiker said some bodies were taken to a fish market in the town because the mortuaries were full.

Abdulmalik Jarrallah, head of the Health Ministry office in Hodeida, said fishing boats carried dead and injured refugees to the port early Friday. “Some of the injured are in critical condition,” he said. “Unfortunately we expect that the death toll will go up.”

U.N. officials have helped some Somali refugees in Yemen return home. But the boat that came under attack was headed for Sudan with 140 people aboard, the U.N. refu­gee agency said. That suggested it was following an increasingly active migrant route to try to reach Libya and the smuggler boats making the dangerous Mediterranean crossings to Europe.

The U.N. High Commissioner for Refugees (UNHCR) is “appalled by the deaths,” said William Spindler, the refugee agency’s spokesman. The International Committee of the Red Cross called for an immediate investigation.

The attack underscores the perils for any vessel operating off Yemen, which has been ravaged by a nearly two-year-old war led by Saudi forces against rebel fighters believed to be supported by Iran and others. The country is also a base for militant factions including an al-Qaeda branch that was targeted by a U.S.-led raid in late January. The casualties in that raid included a Navy SEAL who was killed during a counterattack.

Thousands of Somali refugees — who came to Yemen to escape their country’s own chaos — have once again fled. Some have returned to Somalia, and others have tried to make it to Europe through Libya — a route marked by a sharp rise in deaths.

On Friday, the IOM released a report documenting 7,763 migrant deaths in 2016 worldwide, a 27 percent increase from the 6,107 recorded in 2015. Two-thirds of those deaths last year occurred in the Mediterranean Sea.

U.N. officials said they believed the refugees killed Thursday were probably headed to North Africa and then across the Mediterranean.

“As conditions in Yemen deteriorate as a result of the ongoing conflict and humanitarian crisis, refugees and asylum seekers are increasingly fleeing onward, following established migratory routes, including across the Red Sea to Sudan with the intention of heading onward to Europe,” Spindler said.

Despite the conflict, Yemen still harbors 255,000 Somali refugees, according to UNHCR. Between March 2015 and January 2017, 34,760 people fled from Yemen to Somalia — a mix of Somali refugees returning home and Yemenis escaping their country, according to the Regional Mixed Migration Secretariat, a research organization.

Some of the area around the strait is controlled by Houthi rebel fighters, who overran Yemen’s capital, Sanaa, in 2014 and forced the Saudi-backed president, Abed Rabbo Mansour Hadi, to flee into exile in Saudi Arabia.

Somalia is still struggling with a powerful Islamist insurgency and a looming famine, prompting many Somali refugees in Yemen to pay smugglers to take them to Europe rather than return home.

It is unclear exactly how many Somalis are departing Yemen with hopes of arriving in Europe. Overall, more than 6,500 Somalis arrived in Europe by sea in 2016, making Somalia one of the most common countries of origin for refugees, according to the IOM.

Sieff reported from Nairobi. William Branigin, Brian Murphy and Karen DeYoung in Washington contributed to this report.