At least 12 soldiers have been killed at a checkpoint near Bani Walid in Libya.

The attack came two years after former Libyan leader Muammar Gaddafi was overthrown and killed in a civil war.

The north African country's fragile central government is struggling to control rival militias competing for influence in the aftermath of the conflict.

A spokesman for the army joint chief of staff Ali Sheikhi said that:"The ambush happened on the road between Bani Walid and the town of Tarhouna."

He continued: "that the army checkpoint "came under heavy gunfire. Between 12 and 15 soldiers were killed."

Army Captain Hassan al-Saidah said 15 soldiers had been killed and five wounded in the attack, which forced officials to close the main road to Bani Walid.

Officials did not say who might be responsible for the ambush.

Clan and tribal rivalries, as well as Islamist groups,have flourished in the absence of strong central government and Libya's armed forces cannot fully maintain order.