Six people were killed and 21 wounded on Sunday after an explosive-packed vehicle went off near the western Libyan city of Misrata, a security official has said.

The Islamic State group, which has been fighting Misratan forces for more than a month in Sirte about 120 miles east of Misrata, claimed the attack, according to AFP.

IS's FM radio station called Al-Bayan reported on Sunday that a Sudanese volunteer, named Abu Dujana, had carried out the attack on behalf of its Tripolitania branch.

Two people were seen driving the car heading from Bani Walid to adjacent militia-controlled Misrata when they stopped at a checkpoint between the two cities, a member of Misrata security committee, Mohamed Saleh, told Anadolu Agency.

The two drivers left the car and detonated it remotely, leaving several people dead or injured, Saleh said.

Lutfti Belkasim, a physician at Misrata Hospital, said that the six civilians have died as a result of the explosion.

Libya has remained in a state of turmoil since a bloody uprising ended the decades-long rule of strongman Muammar Gaddafi in late 2011.

Since then, the country's stark political divisions have yielded two rival seats of government, each with its own institutions and military capacities.

Vying for legislative authority are the Tobruk-based House of Representatives and the General National Congress in Tripoli.

The two assemblies support two rival governments respectively headquartered in the two cities.