Pakistan has partially unblocked the popular video sharing website YouTube, but links to sacrilegious or profane material will remain restricted, a top government official said on Thursday.

Pakistan blocked YouTube last week in a bid to contain content deemed blasphemous, a day after it cut off access to social networking site Facebook indefinitely because of an online competition to draw the Prophet Mohammad.

We have lifted the ban on only that part which is not displaying any sacrilegious or profane material, Naguibullah Malik, Secretary of Information Technology and Telecom, told Reuters.

But while many of the videos connected with the competition were blocked, others remained accessible in Pakistan on Thursday morning.

Most Muslims consider any representation of the Prophet Mohammad to be blasphemous.

Malik said his ministry had acted on its own in blocking YouTube, but that Facebook was banned on the orders of a court.

We had banned one URL of the Facebook but the High Court ordered the banning of the entire Facebook, he said.

The next hearing on the case will be May 31.

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.

(Reporting by Augustine Anthony; Editing by Chris Allbritton and Alex Richardson)