London: A British teacher held hostage by Islamist militants in Libya for over four months has been reunited with his family in the UK after being released.

David Richard Bolam, who worked as the principal at the International School Benghazi in northern Libya, was abducted in May this year, while out on a shopping trip.

The 53-year-old from Craven Arms in Shropshire, was reunited with his family on Thursday night, the UK foreign office here said.

Ged O'Connor Challis, who worked with Bolam at the International School until he left with his wife in December 2013, said Bolam was "single-minded and stubborn" and that he had decided to stay in the country despite growing violence. A US teacher from the same school had been shot dead last December.

It is believed his release was secured by local political factions in Libya and that money changed hands through unofficial channels as the UK has a policy of not paying ransoms for British hostages, the Telegraph reported.

A video released in August showed Bolam making a heartfelt plea to Prime Minister David Cameron for securing his release.

In the video, Bolam begged Cameron to reunite him with his family and agree to a hostage swap to secure his release.

The situation in Libya started deteriorating in 2011 when its longtime leader Muammar Gaddafi was toppled in a violent uprising after over four decades of his uninterrupted rule.

Benghazi, Libya's second largest city, has since been the scene of many violent clashes between competing armed groups owing allegiance to rival militias and Islamist groups.

On September 11, 2012, Islamic militants were able to successfully attack the American consulate in Benghazi and to kill the American ambassador to Libya, Christopher Stevens.