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, officials 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.

The Pakistan Telecommunication Authority (PTA), the official telecommunications regulatory agency, said it had received officials instructions to unblock Facebook except for links which contain blasphemous content.

We are issuing instructions to Internet service providers to restore Facebook, and it will be done by evening, PTA spokesman Khurram Imran told Reuters.

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.

(Editing by Chris Allbritton and Miral Fahmy)

(For more Reuters coverage of Afghanistan and Pakistan, see: http://www.reuters.com/news/globalcoverage/afghanistanpakistan)