Libyan coastguard officers opened fire on two boats loaded with refugees while rescue attempts were under way in the Mediterranean Sea on Tuesday, according to nongovernmental organisations involved in the operations.

The Libyan coastguard has rejected the accusations and demanded evidence.

But those at the scene told Al Jazeera that at around noon, as rescue workers from four groups - French NGOs SOS Mediterranee and Doctors Without Borders (MSF), Italian NGO Save the Children and German NGO Jugend Rettet - were trying to save refugees, a speedboat equipped with four machine guns and bearing the emblem of the Libyan coastguard arrived at the scene.

The speedboat approached the rescue operation at high speed, creating large waves that made it difficult for the refugees to board rubber dinghies, the witnesses said.

Shortly after, a series of gunshots could be heard coming from near the dinghies, Laura Garel, a communications officer on the SOS Mediterranee's rescue vessel Aquarius, told Al Jazeera.

'Situation was critical'

When the shooting started, about 70 people jumped into the water from the refugee boats, said the witnesses.

The shots were seemingly aimed at the people on the boats, according to Jonas, a captain aboard the Iuventa, another rescue vessel at the scene operated by Jugend Rettet.

"For us the situation was critical," said Jonas. "We are here to help, but were forced to stand idly by as to avoid getting hit by a bullet ourselves."

While the the Iuventa crew was unable to determine whether anyone was harmed by the shooting, SOS Mediterranee said there were no casualties or direct injuries.

The aid organisations and refugees said at least two Libyan coastguard officers stole mobile phones and money from passengers.

"When the Libyans pointed their weapons at us, asking us to give them all our money and cell phones and telling us to jump in the water, we did what they said," one Gambian survivor told SOS Mediterranee volunteers.

"I was not afraid. I preferred to die at sea than being pushed back and to die in Libya."

'Reckless behaviour'

Mathilde Auvillain of SOS Mediterranee in Sicily described the incident as "confusing" and said it was the first time the Libyan coastguard - which usually only observes operations - interrupted the group's rescue efforts.

However, in a previous example of how NGO operations are interrupted, Sea-Watch said on May 10 that Libya's coastguard intercepted about 300 people on a wooden boat and returned them to Tripoli.

"The Libyan coastguard showed very little regard for the well-being of the people in the boats in distress," said Annemarie Loof of MSF.

"Their behaviour was reckless - if not directly threatening - to the people on the boats."

When the Libyans pointed their weapons at us, asking us to give them all our money and cell phones and telling us to jump in the water, we did what they said. I was not afraid. I preferred to die at sea than being pushed back and to die in Libya Gambian survivor

The Libyan coastguard denied Tuesday's incident took place, calling the accusations "illogical".

Ayob Amr Ghasem, a Libyan navy spokesman, challenged the rescue groups to produce evidence of their claims.

"Why would we have shot at boats if we are the ones that always save them?'' Ghasem was quoted by the Italian ANSA news agency as saying.

Despite the circumstances, more than 1,800 people were rescued, including a two-week old baby.

"The dramatic situation on Tuesday - the sad daily situation in the Mediterranean - shows once again the completely inadequate response to the humanitarian crisis that has cost already tens of thousands of lives," co-founder of SOS Mediterranee Sophie Beau said.

"The imperative of maritime search and rescue cannot be left to NGOs alone."

Abuse in Libya

Libya is the main departure point for refugees hoping to reach Europe by sea.

In March 2016, the Balkan route was permanently shut, trapping tens of thousands of asylum seekers in Greece and slowing Aegean Sea crossings to a trickle.

The route between Libya and Italy remains busy.

Migrants and refugees living in Libya or passing through say they are subject to a range of abuses, with hundreds bought and sold in modern-day slave markets, according to the Switzerland-based International Organization for Migration (IOM).

READ MORE: African migrants traded in Libya's 'slave markets', IOM says

European vessels that intercept refugee boats in international waters are obligated to bring those on board to Europe, according to Judith Sunderland, associate director for Europe at Human Rights Watch.

In Tuesday's incident, two of the refugee boats were directed back to Libya by coastguard officers, according to Iuventa, despite being 14 nautical miles from Libya's coast and thus in international waters.

"Certainly we believe that migration cooperation with Libya is deeply problematic," Sunderland said.

"[The EU] should be doing a lot more to get people out of Libya in a safe way and a lawful way so they don't have to risk their lives to do so."