At least nine Egyptians and three Libyan people smugglers have been killed in a dispute over money in the Libyan town of Bani Walid, a local official said.

The official, who was unnamed, told the Reuters news agency on Wednesday that a group of Egyptians had killed the traffickers and tried to drive away with the bodies, but they were stopped at a checkpoint when blood was noticed on their car.

A fourth smuggler then went to the police station where the Egyptians were being held, and opened fire on them, he said.

The United Nations mission to Libya said as many as 13 Egyptians had been killed in the incident and called for an investigation.

WATCH: Libya - The migrant trap

The Egyptian foreign ministry said in a statement that up to 16 Egyptians were killed.

Hundreds of thousands of undocumented non-Libyans are currently in the country. Some have settled there to work, while others are seeking to cross the Mediterranean Sea for Europe.

Powerful smuggling networks linked to Libya's numerous armed groups generally control the flow of people, and those using the route are frequently subjected to abuses.

Source: Agencies