More than 20 refugees are feared to have died after armed men attacked an overcrowded dinghy during a rescue operation in the Mediterranean Sea.

Sea-Watch, a German charity, said its rescue ship was deployed to help the vessel by the Italian coastguard after it was spotted 14 nautical miles off the Libyan coast on Friday.

They arrived to find a rubber dinghy packed with 150 migrants and asylum seekers, sending speedboats to give those on board life jackets and help them to safety.

But as the operation continued, a vessel that appeared to be marked with the insignia of Libya’s national coastguard approached, with armed men boarding the migrant boat and attempting to detach its motor.

A spokesperson for Sea-Watch says the men “attacked the refugees, hitting them with clubs”, while preventing the group’s two speedboats from intervening.

“The violent intervention caused a situation of mass panic on board the rubber boat…one tube of the rubber boat collapsed, causing the majority of the 150 people to slip into the water.

“Our crew immediately tried to rescue as many as possible but a number of people could not be saved.”

At least four bodies have been discovered so far, with another four people receiving urgent medical treatment after being pulled from the water unconscious. More than 20 other passengers were missing and feared to have drowned.

Italian coastguard rescues thousands of refugees off coast of Libya

“This latest incident of alleged Libyan official units endangered not only the crew of rescue volunteers but moreover caused the death of many migrants,” Sea-Watch said in a statement.

“It is unclear why [what appeared to be the] Libyan Coast Guard engaged the way it did. Sea-Watch calls for an immediate and detailed investigation of this violation of humanitarian law.”

Sea-Watch’s rescue ship remained in operation on Friday and continued to respond to vessels in distress at the direction of Italian authorities.

Britain is among the countries supporting the EU’s anti-smuggling Operation Sofia mission and is training Libyan coastguards and naval personnel in an attempt to stem the number of boats being launched from the country’s shores.

It was not immediately possible to verify whether the attackers were members of Libya’s coastguard or using a stolen vessel, but the incident followed previous accounts of the force intercepting refugees at sea.

Amnesty International said asylum seekers recounted being beaten with wooden clubs and rubber hoses, as well as being shot and tortured at official detention centres back on dry land.

Friday’s assault came after another rescue vessel was attacked by armed men in August.

Refugee crisis - in pictures Show all 27 1 /27 Refugee crisis - in pictures Refugee crisis - in pictures A child looks through the fence at the Moria detention camp for migrants and refugees at the island of Lesbos on May 24, 2016. AFP/Getty Images Refugee crisis - in pictures Ahmad Zarour, 32, from Syria, reacts after his rescue by MOAS (Migrant Offshore Aid Station) while attempting to reach the Greek island of Agathonisi, Dodecanese, southeastern Agean Sea Refugee crisis - in pictures Syrian migrants holding life vests gather onto a pebble beach in the Yesil liman district of Canakkale, northwestern Turkey, after being stopped by Turkish police in their attempt to reach the Greek island of Lesbos on 29 January 2016. Getty Images Refugee crisis - in pictures Refugees flash the 'V for victory' sign during a demonstration as they block the Greek-Macedonian border Refugee crisis - in pictures Migrants have been braving sub zero temperatures as they cross the border from Macedonia into Serbia. Refugee crisis - in pictures A sinking boat is seen behind a Turkish gendarme off the coast of Canakkale's Bademli district on January 30, 2016. At least 33 migrants drowned on January 30 when their boat sank in the Aegean Sea while trying to cross from Turkey to Greece. Getty Images Refugee crisis - in pictures A general view of a shelter for migrants inside a hangar of the former Tempelhof airport in Berlin, Germany Refugee crisis - in pictures Refugees protest behind a fence against restrictions limiting passage at the Greek-Macedonian border, near Gevgelija. Since last week, Macedonia has restricted passage to northern Europe to only Syrians, Iraqis and Afghans who are considered war refugees. All other nationalities are deemed economic migrants and told to turn back. Macedonia has finished building a fence on its frontier with Greece becoming the latest country in Europe to build a border barrier aimed at checking the flow of refugees Refugee crisis - in pictures A father and his child wait after being caught by Turkish gendarme on 27 January 2016 at Canakkale's Kucukkuyu district Refugee crisis - in pictures Migrants make hand signals as they arrive into the southern Spanish port of Malaga on 27 January, 2016 after an inflatable boat carrying 55 Africans, seven of them women and six chidren, was rescued by the Spanish coast guard off the Spanish coast. Refugee crisis - in pictures A refugee holds two children as dozens arrive on an overcrowded boat on the Greek island of Lesbos Refugee crisis - in pictures A child, covered by emergency blankets, reacts as she arrives, with other refugees and migrants, on the Greek island of Lesbos, At least five migrants including three children, died after four boats sank between Turkey and Greece, as rescue workers searched the sea for dozens more, the Greek coastguard said Refugee crisis - in pictures Migrants wait under outside the Moria registration camp on the Lesbos. Over 400,000 people have landed on Greek islands from neighbouring Turkey since the beginning of the year Refugee crisis - in pictures The bodies of Christian refugees are buried separately from Muslim refugees at the Agios Panteleimonas cemetery in Mytilene, Lesbos Refugee crisis - in pictures Macedonian police officers control a crowd of refugees as they prepare to enter a camp after crossing the Greek border into Macedonia near Gevgelija Getty Images Refugee crisis - in pictures A refugee tries to force the entry to a camp as Macedonian police officers control a crowd after crossing the Greek border into Macedonia near Gevgelija Getty Images Refugee crisis - in pictures Refugees are seen aboard a Turkish fishing boat as they arrive on the Greek island of Lesbos after crossing a part of the Aegean Sea from the Turkish coast to Lesbos Reuters Refugee crisis - in pictures An elderly woman sings a lullaby to baby on a beach after arriving with other refugees on the Greek island of Lesbos after crossing the Aegean sea from Turkey Getty Images Refugee crisis - in pictures A man collapses as refugees make land from an overloaded rubber dinghy after crossing the Aegean see from Turkey, at the island of Lesbos EPA Refugee crisis - in pictures A girl reacts as refugees arrive by boat on the Greek island of Lesbos after crossing the Aegean sea from Turkey Getty Images Refugee crisis - in pictures Refugees make a show of hands as they queue after crossing the Greek border into Macedonia near Gevgelija Getty Images Refugee crisis - in pictures People help a wheelchair user board a train with others, heading towards Serbia, at the transit camp for refugees near the southern Macedonian town of Gevgelija AP Refugee crisis - in pictures Refugees board a train, after crossing the Greek-Macedonian border, near Gevgelija. Macedonia is a key transit country in the Balkans migration route into the EU, with thousands of asylum seekers - many of them from Syria, Afghanistan, Iraq and Somalia - entering the country every day Getty Images Refugee crisis - in pictures An aerial picture shows the "New Jungle" refugee camp where some 3,500 people live while they attempt to enter Britain, near the port of Calais, northern France Getty Images Refugee crisis - in pictures A Syrian girl reacts as she helped by a volunteer upon her arrival from Turkey on the Greek island of Lesbos, after having crossed the Aegean Sea EPA Refugee crisis - in pictures Refugees arrive by boat on the Greek island of Lesbos after crossing the Aegean sea from Turkey Getty Images Refugee crisis - in pictures Beds ready for use for migrants and refugees are prepared at a processing center on January 27, 2016 in Passau, Germany. The flow of migrants arriving in Passau has dropped to between 500 and 1,000 per day, down significantly from last November, when in the same region up to 6,000 migrants were arriving daily.

Médecins Sans Frontières (MSF) said no refugees were on board its ship, the Bourbon Argos, when gunmen opened fire from a speedboat off the coast of Libya.

Rescue workers hid in a designated safe area while the attackers boarded and searched the empty ship for almost an hour on 17 August, with no one harmed.

MSF said it could not identify the group or their motivation, but described them as “professional and well-trained”.

Isis is among a number of armed groups operating in Libya, where a fragile new government is attempting to end a bloody competition for territory between rival militias.

The country’s north-western coast has become the main launching point for migrant boats after instability and lawlessness in the wake of its civil war enabled smuggling gangs to set up a ruthless and profitable trade.

A succession of disasters in waters between Libya and Italy has made the Central Mediterranean the deadliest sea crossing in the world, with several naval and humanitarian ships patrolling the zone in an attempt to prevent sinkings.

More than 3,100 migrants have died on the route this year – drowning or suffocating in overcrowded holds – putting 2016 on course to be the deadliest ever year for refugees trying to reach Europe.