British schoolteacher David Bolam has been released after nearly five months of captivity in Libya, reportedly after payment of a ransom to his Islamist captors.

The Foreign Office in London late Saturday confirmed he was free, saying they were “glad that David Bolam is safe and well after his ordeal and that he has been reunited with his family”.

Bolam was kidnapped by militants in May in Libya’s second city Benghazi, much of which is under the control of Islamists.

Head teacher at the international school in Benghazi, he is reportedly 53 years old and from Shropshire in western England. 

An American teacher from the same school, 33-year-old Ronnie Smith, was shot dead during his morning jog in December last year.

Bolam’s captors had contacted the Libyan director of the school to demand a ransom, according to a source at the establishment speaking on condition of anonymity.

The BBC reported that his release had been secured by local political factions and that money had changed hands. It said that Bolam had been flown back to Britain on Thursday.

His kidnapping had not been reported at the request of officials.

Bolam’s release follows the beheading of British aid workers David Haines and Alan Henning, among four Western hostages executed since August by Islamic State (IS) jihadists.

American journalists James Foley and Steven Sotloff were also brutally executed by IS militants operating in Syria and Iraq, with all four murders made public in videos.

‘One of the best’

The SITE intelligence group identified a video posted on YouTube last month of Bolam, looking dishevelled and wearing a white T-shirt, appealing for British Prime Minister David Cameron to help secure his release.

The video, apparently recorded in August, was released by a group that called itself Jeish al-Islam (Army of Islam) but SITE could not authenticate it due to a lack of information.

Libya has been sliding into chaos since longtime leader Moamer Kadhafi was toppled in an uprising three years ago, with interim authorities confronted by powerful militias that fought to oust him.

The cradle of the uprising against Kadhafi, Benghazi is now regularly the scene not only of fighting but also the murders of members of the security forces, political activists and journalists.

A former teacher at Bolam’s school, Ged O’Connor Challis, told the BBC that he had spoken to Bolam on the telephone the morning he was kidnapped. 

He said Bolam had been captured while he was out shopping.

“He is single-minded and stubborn,” Challis added. “He is a very bright person. He is an English teacher — one of the best I have ever met.”

Michael Aron, Britain’s ambassador to Libya, wrote on Twitter: “Delighted Benghazi Head Teacher David Bolam has been released after over 4 months in captivity”.

The Foreign Office said it had been supporting Bolam’s family during his captivity and that they had appealed for privacy.