More than 40 Somali refugees have been killed in an attack on a boat off the coast of Yemen while attempting to flee the country’s brutal civil war.

Coastguard authorities in the Houthi rebel stronghold of Hodeida said a helicopter gunship attacked the vessel they were travelling on in the Red Sea.

A Yemeni people smuggler who survived the attack said the boat had set sail overnight, aiming to cross to Sudan.

Al-Hassan Ghaleb Mohammed said women and children were among his passengers from the port of Ras Arra, along the southern coastline in Yemen’s Hodeida province.

African migrants on a boat in the southern port city of Aden on 26 September 2016, before being deported to Somalia (Getty) (AFP/Getty Images)

He told the Associated Press that their boat had reached around 30 miles from shore when the helicopter gunship approached and opened fire, sparking panic on board.

Migrants finally managed to hold up torches to show they were civilians, when he said the helicopter stopped firing.

Photos that were too graphic to publish showed the bodies of women and men in civilian clothes lying on top of one another in the partially destroyed boat, their belongings splattered with blood. Children were believed to be among the dead.

Mohamed al-Alay, a coastguard official, told Reuters the refugees, carrying official UN documents, were attacked by an Apache helicopter near the Bab-el-Mandeb strait.

Houthi rebels accused the Saudi-led air coalition of carrying out the attack, following heavy bombardment in the area, where it accuses Shia fighters of smuggling weapons into Hodeida in small boats.

The International Organisation for Migration said at least 42 people had been killed and dozens injured on the boat, which had about 140 people on board. The survivors – 75 men and 15 women – were taken to detention centres.

The UN Refugee Agency (UNHCR) said it was “deeply distressed” by the casualties and called for all parties in the Yemeni civil war to protect civilians in accordance with international law.

The situation in Yemen Show all 14 1 /14 The situation in Yemen The situation in Yemen Houthi supporters trample on a US flag during a gathering mobilizing more fighters into several Yemeni battlefronts, in Sana'a, Yemen EPA The situation in Yemen People carry the coffins of men, who were killed in the recent Saudi-led airstrikes during their funeral, in the Old City of Sanaa, Yemen AP The situation in Yemen Pro-government fighters give food to Yemeni children on the road leading to the southwestern port city of Mokha. Yemeni rebels are putting up fierce resistance in a key Red Sea port city where they are encircled by pro-government force Getty Images The situation in Yemen A Yemeni stands in front of a graffiti protesting US military operations in war-affected Yemen, in Sana'a, Yemen. According to reports, US Special Forces troops allegedly disembarked from US helicopters in the Yemeni town of Yakla and attacked several houses belonging to members of the terrorist group Al-Qaeda, killing three high-ranking Al-Qaeda members and nine civilians, six women and three children. One American serviceman has been killed and three injured in the attack EPA The situation in Yemen US Special Forces troops allegedly disembarked from US helicopters in the Yemeni town of Yakla and attacked several houses belonging to members of the terrorist group Al-Qaeda, killing three high-ranking Al-Qaeda members and nine civilians, six women and three children. One American serviceman has been killed and three injured in the attack EPA The situation in Yemen A Yemeni female fighter supporting the Shiite Huthi rebels, and carrying weapons used for ceremonial purposes, takes part in an anti-Saudi rally in the capital Sanaa Getty Images The situation in Yemen Yemeni female fighters supporting the Shiite Huthi rebels, and carrying weapons used for ceremonial purposes, take part in an anti-Saudi rally in the capital Sanaa Getty Images The situation in Yemen A boy shouts slogans next to pro-Houthi fighters, who have been injured during recent fighting, during a rally held to honour those injured or maimed while fighting in Houthi ranks in Sanaa, Yemen Reuters The situation in Yemen Balls of fire and smoke rise from a Houthi-held military camp following alleged Saudi-led airstrikes, in Sana'a, Yemen EPA The situation in Yemen Yemenis search under the rubble of damaged houses following reported Saudi-led coalition air strikes on the outskirts of the Yemeni capital Sanaa Getty Images The situation in Yemen A Yemeni boy looks on as Yemenis search under the rubble of damaged houses following reported Saudi-led coalition air strikes on the outskirts of the Yemeni capital Sanaa Getty The situation in Yemen A Yemeni boy sits amidst the rubble of damaged houses following reported Saudi-led coalition air strikes on the outskirts of the Yemeni capital Sanaa AFP/Getty The situation in Yemen Marine One with US President Donald Trump flies with a decoy and support helicopters to Dover Air Force Base in Dover, Delaware, for the dignified transfer of Navy Seal Chief Petty Officer William 'Ryan' Owens who was killed in Yemen Getty Images The situation in Yemen US President Donald Trump aboard the Marine One to greet the remains of a US military commando killed during a raid on the al Qaeda militant group in southern Yemen on Sunday, at Dover Air Force Base, Delaware, US Reuters

“UNHCR is appalled by this tragic incident, the latest in which civilians continue to disproportionately bear the brunt of conflict in Yemen,” spokesperson William Spindler said.

“UNHCR has been following up to provide urgent assistance and support to the survivors and to the families of those deceased.”

The agency warned that conditions in Yemen were continuing to deteriorate, forcing asylum seekers to leave the country either northwards or across the Red Sea, including some with the intention of reaching Europe.

“This tragic incident is the latest in which innocent civilians, including Yemenis, refugees, asylum seekers and migrants, continue to suffer and disproportionately bear the brunt of the conflict in Yemen,” Mr Spindler said.

It was not immediately clear who carried out the attack, although Saudi-led forces including the United Arab Emirates are known to deploy Apache helicopters as part of their air campaign in support of President Abdrabbuh Mansour Hadi.

The coastal province of Hodeida has come under heavy bombardment in recent years as a stronghold of Houthi rebels, who are fighting the internationally-recognised government alongside forces loyal to former President Ali Abdullah Saleh.

Yemen’s civil war, which is about to enter its third year of bloodshed, has allowed terrorist groups including Isis and al-Qaeda in the Arabian Peninsula to seize territory and carry out attacks.

2.1 million children are facing famine in Yemen

Despite violence that has left more than 10,000 people dead and 17 million facing starvation, African migrants seeking work in Saudi Arabia have continued using Yemen as a transit point.

Yemen is hosting over 255,000 Somali refugees, with more than 117,000 new asylum seekers arriving in the country last year as the UNHCR ran a campaign warning of the dangers of crossing the Gulf of Aden and Red Sea, as well as inside the country.

Oxfam warned that with the conflict worsening, Somalis are being displaced for a second time, joining thousands of people attempting to flee on boats to the Horn of Africa.

Almost 1 million Somalis are displaced in surrounding countries and 1.1 million inside the country itself according to the UN, which said the three-decade-long refugee crisis is “among the most protracted in the world”.

Peter Salisbury, a senior research fellow in the Middle East and North Africa Programme at Chatham House, said it was the first military attack on a refugee boat he was aware of. Describing the conflict as a “forgotten war”, he said many migrants had been unable to leave the Yemen.

“Although it has displaced hundreds of thousands of people they haven’t been able to flee or get further than neighbouring countries,” he told The Independent.

“We haven’t seen the flow of refugees into Europe, which makes a huge difference in public understanding and the western approach.”

Somali refugees were previously killed in Yemen during a brief conflict between northern and southern forces in 1994, when hundreds died after their camp was caught in the crossfire.