BEIRUT (Reuters) - Gunmen seized a Lebanese soldier on Wednesday near a town at the border with Syria where Islamist insurgents took 19 soldiers captive in early August, a security source said.

It was not immediately clear who had seized the soldier, who was identified by the source as a resident of the town of Arsal where he was taken on Wednesday.

Two of the Lebanese soldiers taken from Arsal in early August have been beheaded by militants affiliated with Islamic State, one of the groups that took part in an incursion into the town that triggered five days of deadly battles with the army.

Another two of the soldiers have been freed.

Later on Wednesday Islamic State said it would kill another captive soldier within 24 hours because its demands had not been met, according to a statement posted on social media and addressed to the Lebanese government. There was no immediate comment from Lebanese authorities.

Some of the soldiers are being held by the Nusra Front, al Qaeda's official affiliate in the Syrian civil war.

The Sunni militants want the Lebanese authorities to free Islamist prisoners held in Lebanon for past militancy.

(Writing by Tom Perry; Editing by Samia Nakhoul, Toni Reinhold)