A Pakistani court on Monday lifted a ban on social networking website Facebook which had carried a competition to draw the Prophet Mohammad, but access to any blasphemous material will remain blocked, a lawyer said.

Any representation of the Prophet Mohammad is deemed un-Islamic and blasphemous by Muslims, which constitute the overwhelming majority in Pakistan and Facebook was blocked two weeks ago because of the online caricature contest.

The Lahore High Court ordered Facebook unblocked after getting assurance from the government that blasphemous material would no longer be available in Pakistan, lawyer Azhar Siddique told Reuters.

The government has assured the court on behalf of the website that the blasphemous material would not seen in Pakistan, said Siddique, a representative of the Islamic Lawyers Forum, who sought ban on Facebook.

The court ... told me that I can file a contempt of court petition if blasphemous material is again seen on the website in Pakistan, because it is a violation of Pakistani law.

Facebook was still unavailable mid-day in Islamabad, but was expected to return by the evening.

The Pakistani authorities had also blocked access to video networking site, YouTube, to contain un-Islamic content, but this was partially lifted last week although links to videos containing sacrilegious or profane material remain restricted.

The contest to draw caricatures of Prophet Mohammad was described by its organizers as a snarky response to Muslim bloggers who had objected at the creators of the Comedy Central television show South Park depicting him in a bear suit.

While many Pakistanis supported the online crackdown, some said the government should have blocked specific videos or pages instead of blocking entire websites.

The publication of cartoons of the Prophet in Danish newspapers in 2005 sparked deadly protests in Muslim countries. About 50 people were killed during violent protests in Muslim countries in 2006, five of them in Pakistan.

On Sunday, Bangladesh, another majority Muslim country, also blocked access to Facebook over objectionable material about the Prophet Mohammad.

(Additional reporting and writing by Zeeshan Haider; Editing by Chris Allbritton and Miral Fahmy)