Air strikes have targeted a warehouse and a factory in a western Libyan city, killing eight people and wounding 24 as the country's warring sides gave different accounts of the attack.

The attacks occurred on Tuesday in Zwara, 110km west of the capital, Tripoli.

Hafez Moammar, a security spokesman in the city, which is allied with Tripoli's authorities, said one strike hit a warehouse used to store food and the other a chemical factory.

But an army spokesman said the buildings were arms depots used by "terrorists," a term Libya's military and the elected government, based in the country's east, use for armed groups.

Inside Story - Is Libya heading for chaos?

The town's Media Centre said on its Facebook page that eight people were killed, two Libyans and six African workers. Those wounded include 14 Libyans and 10 foreign workers. It was unclear if anyone was killed in the factory.

Moammar said the warplanes were operating under the command of Khalifa Haftar, a former army general who last spring launched an offensive against armed groups in the eastern city of Benghazi.

In August, the fighters took Tripoli while in October, Hifter and Libya's elected government joined ranks against the armed groups.

A spokesman for Haftar's forces, Mohammed Hegazi, said they had warned their rivals against using "ports and airports" to transport weapons, ammunition and fighters.

Zwara's Media Centre posted footage of the strikes, showing black smoke rising into the sky. A video purportedly from inside the warehouse shows partially destroyed walls and ceiling, scattered bags of flour on the floor and a bombed-out truck as a voice-over sarcastically says, "Look, here is the ammunition."

The fighting, Libya's worst crisis the 2011 overthrow and killing of longtime dictator Muammar Gaddafi, has left the country with two rival governments and parliaments, displaced hundreds of thousands of people and driven out foreigners and diplomats.

Source: Agencies