The British Library has blamed its web filter for blocking access to an online version of Hamlet.

Author Mark Forsyth tried to access the Massachusetts Institute of Technology’s free copy of Shakespeare’s play earlier this week when he needed to check a line in the course of writing his new book.

But when he Googled Hamlet MIT a message came up from the library to say access was blocked due to ‘violent content’.

Forsyth approached the IT department, and he wrote on his blog: "I asked them how it was that I could still access Youtube, Facebook and Twitter.

"I asked why the girl at the next desk to me had been able to spend the last half hour on Guardian Soulmates, while the Massachusetts Institute of Technology’s website was banned. They shrugged.

"I asked if they saw the problem, perhaps just the symbolism, of Hamlet being banned in the British Library. They shrugged."

However, the British Library has since released a statement blaming their new WiFi provider for blocking access to the text in reading rooms and public spaces.

It also confirmed that it collects "all digital material" as well as printed texts, which should be accessible to all readers aged over 18 in their reading rooms.

The statement added: "However, in our public areas where there are regular visits by schoolchildren, we filter certain online content, such as pornography and gambling websites.

"It’s early days in the implementation of this service and we are aware that the new filter has been blocking certain sites erroneously. We are actively working to resolve this issue.

"We are asking readers to get in touch with our team at electronic.services@bl.uk with details of URLs that are blocked so we can rectify any issues – so far we have been able to unblock sites within 10 minutes.

"We plan to continue to work with our readers to solve further issues."

The news comes after Prime Minster David Cameron announced plans to ensure ISPs automatically block households’ access to porn websites unless they request otherwise, a move Cameron aims to make law by the end of 2014.