"UNHCR ... renews its call for protecting civilian lives including refugees and migrants in detention and respecting international humanitarian law and international human rights law," a UNHCR statement said.
The UN refugee agency also expressed concern about a recent deadly airstrike that hit an area close to a refugee center in the city of Zawiya, some 45 km west of the capital Tripoli.
"UNHCR reiterates its call for the orderly release of all refugees and asylum-seekers held in detention centers close to conflict areas and stands ready to provide them with the assistance upon release into urban settings," the statement said, according to Xinhua news agency.
Thousands of illegal immigrants, mostly Africans, choose to cross the Mediterranean Sea toward Europe from Libya although the UNHCR has repeatedly said Libya is not a safe port given its deteriorating security conditions.
Shelters in Libya are crowded with immigrants rescued at sea or arrested, despite international calls to close those centers.
The east-based army has been leading a military campaign since April in an attempt to take over Tripoli from the rival UN-backed government.
Thousands have been killed and injured in the fighting, while more than 120,000 civilians have been displaced.