Violence in Libya is having a devastating impact on health care, a report by the UN Human Rights Office says.

Hospitals are routinely getting shelled and looted, with their corridors becoming the scene of shootings, it says.

Rebels often force doctors at gunpoint to give preferential treatment to their injured fighters and relatives.

Those carrying out the assaults include armed groups who are nominally allied to the UN-backed government.

In the past year, the UN recorded more than 30 such attacks across Libya, but the agency says the number could be significantly higher, as medical staff do not report cases fearing reprisals.

The UN High Commissioner for Human Rights, Zeid Ra'ad Al Hussein, says violations that include directing attacks against hospitals and personnel “may constitute war crimes".

Libya has been in chaos since the overthrow and killing of long-time leader Col Muammar Gaddafi in 2011.