David Bolam has been released from captivity after being held hostage in Libya since May 2013. YouTube

British teacher David Bolam, who had been held hostage by an Islamist group in Libya for months, has been freed and is safely home in Britain.

Bolam was working at the International School in Benghazi when he was snatched by a group calling itself the Army of Islam in May. It is believed he was out shopping when he was grabbed. His family and the Foreign Office had asked the media not to report his kidnapping.

On 28 August a video of a bearded Mr Bolam pleading for the British government to do something appeared online.

In the 53-second video, Mr Bolam said: "My name is David Richard Bolam. I am a British citizen. I am a teacher. My health is good at the moment. I have been here a very long time."

He then asked the government to consider a prisoner exchange or similar initiative so that he could be freed.

suicide bomb
Benghazi has been chaotic since the overthrow of Libyan leader Muammar Gaddafi in 2011 Reuters

The BBC is reporting that a ransom might have been paid to the school to secure Mr Bolam's release. Local political factions are believed to have been involved in negotiations. However, this would have been arranged through private channels as the UK government, along with the US, but unlike most of Europe, has a policy of never paying ransoms to kidnappers.

A spokeswoman for the Foreign Office said: "HMG never pays ransoms. It is illegal to pay ransoms to a terrorist group."

Benghazi has become increasingly chaotic since the overthrow of Muammar Gaddafi in 2011. Many teachers had left the International School following gun fights and the shooting of US teacher Ronnie Smith in December 2013. Mr Bolam had chosen to stay – reportedly because he didn't want to let his students down.

Not much is known about the Army of Islam, but spokesman for the Quilliam Foundation, Charlie Cooper, told the BBC the fact they released Mr Bolam showed the ideological difference between many Islamist organisations and Islamic State, which in recent weeks has beheaded four hostages including Britons Alan Henning and David Haines.