More than 20 civilians have been killed in an explosion at an ammunition store in the Libyan town of Garabulli in the restive east, officials have said.

"The number of casualties is rising and we are working hard to transfer them to nearest hospitals," Mohamed Assayed, a municipal official, told the Reuters news agency. Some 30 people had been wounded, he added.

Tuesday's blast in Garabulli, a town 50km east of the capital, Tripoli, happened as residents entered the depot, though it was not immediately clear what had triggered the blast.

Assayed said the store was under control of an armed group from the city of Misrata, but the group had left the depot after clashing with local residents.

READ MORE: ISIL losing in Iraq, Syria; gaining in Libya

A Garabulli resident, who also confirmed the deaths, said the clashes erupted after a dispute in a shop between locals and a member of the armed group who was refusing to pay.

Libya has descended into chaos after the toppling and death of Muammar Gaddafi five years ago and has turned into a battleground of rival groups battling for powers.

Libya's nascent military has struggled to secure army bases and curb armed groups, with the power vacuum allowing the Libyan chapter of the Islamic State of Iraq and the levant (ISIL, also known as ISIS) to expand its presence. The group is estimated to have around 5,000 fighters in the country.

Soldiers killed

Also, on Tuesday, at least 18 members of Libya's pro-government forces were killed in clashes with ISIL fighters in several parts of Sirte, as they prepared for a final assault on the groups' stronghold.

A medical source told the Reuters news agency that 70 others were wounded.

The forces - loyal to the Tripoli-based Government of National Accord (GNA) - said "dozens" of ISIL fighters had also been killed in the past 24 hours, adding that they were pinned down in pockets across the coastal city.

The pro-GNA forces said fighters were targeting ISIL-held areas of Sirte with heavy artillery while loyalist aircraft were carrying out sorties every day to strike ISIL or carry out reconnaissance missions.

ISIL has hit back with a string of suicide car bombings in a bid to defend their stronghold on the Mediterranean coast.

At least 184 loyalist troops have been killed and hundreds wounded since the start of the offensive to capture Sirte, 450km east of Tripoli.

The anti-ISIL forces launched an operation in May to retake Sirte, which the armed group has controlled since June last year.

Source: Agencies