Gunmen attacked a Libyan military post southeast of the capital, Tripoli, on Saturday, killing 16 soldiers, officials said.
The attackers rode vehicles mounted with machine guns, a military official said. The highway between the towns of Tarhouna and Bani Walid, on which the post was located, was closed immediately after the attack in an attempt to track down the attackers.
The official said the attack took place at Wishtata area, some 60 kilometers (40 miles) from the entrance to Bani Walid. The town was one of the last strongholds for supporters of dictator Moammar Gadhafi in the country's 2011 civil war, and was besieged again by pro-government militias last year.
Fifteen soldiers died in the attack, and five were wounded, a health official said. One wounded soldier later died at a nearby hospital, the official said, adding that one more soldier remains in critical condition.
Both officials spoke on condition of anonymity in line with institutional regulations.
Libya has been hit by a months-long wave of attacks targeting military officers, activists, judges and security agents.
Gadhafi was deposed and killed after an eight-month uprising that descended into a civil war in 2011. Since then, successive Libyan interim governments have failed to impose law and order. The country remains held hostage by unruly militia forces initially formed to fight Gadhafi.
The militias, which have huge stockpiles of sophisticated weaponry, now threaten Libya's nascent democracy.