A British man who had been held hostage by militants in Libya has been released, the Foreign Office in London said Sunday.

David Bolam was released days after the killing of a British hostage, aid worker Alan Henning, by Islamic State militants fighting in Iraq and Syria — the latest in a series of such murders that have been filmed and posted online.

"We are glad that David Bolam is safe and well after his ordeal, and that he has been reunited with his family," a Foreign Office spokeswoman said. "We have been supporting his family since he was taken."

The Foreign Office declined to comment further on the details of Bolam's case, but British media reported that he had been taken hostage in May and in August was featured in a video posted online in which he pleaded for his life.

Bolam's release was secured through the payment of a ransom, facilitated by local political factions in the eastern Libyan city of Benghazi, where he worked as a teacher, the BBC reported, without citing sources.

The Foreign Office, which does not support the payment of ransoms, declined to comment on the BBC report.

Libya is being racked by violence as the armed groups that helped to topple Moammar Gadhafi in 2011 turn their guns on each other in a struggle for the country's vast oil resources and political domination.