BENGHAZI, Libya (Reuters) - At least four people were killed and 10 kidnapped when suspected Islamic State militants attacked a town in central Libya, military officials said on Monday.

The raid on the desert oasis town of al-Foqha south of Jufra late on Sunday lasted several hours, during which the insurgents set local government and security offices on fire, a military official who asked not to be named said.

Islamic State claimed responsibility for the attack on Monday, according to a statement issued by its Amaq news agency.

Ten people were presumed to have been kidnapped, said Ahmed Mismari, spokesman for the Libya National Army (LNA) of Khalifa Haftar, which controls much of eastern Libya.

Ismail al-Sharif, a lawmaker in the eastern-based House of Representatives, said the attack had probably come as revenge because some town youths had helped catch a local Islamic State leader this month. Further details of that incident were not immediately available.

The town lies in an area marked by poor security deep in the desert where Islamic State withdrew after losing its stronghold Sirte on the central coast in December 2016.

The LNA had recently boosted its presence in the area, moving into al-Foqha as part of efforts to push south. The attackers had left after a LNA unit arrived, Mismari said.

The North African oil producer has two governments. One is allied to commander Khalifa Haftar and based in the east. The other is backed by the United Nations and based in Tripoli in the west.

Suspected Islamic State fighters have also repeatedly attacked oil facilities in the central Libyan desert.