LAHORE, Pakistan — A Pakistani court lifted a ban on Facebook on Monday after officials from the social networking site apologized for a page deemed offensive to Muslims and removed its contents, said a top information technology official.

The Lahore High Court imposed the ban almost two weeks ago amid anger over a page that encouraged users to post images of Islam's Prophet Muhammad. Many Muslims regard depictions of the prophet, even favorable ones, as blasphemous.

"In response to our protest, Facebook has tendered their apology and informed us that all the sacrilegious material has been removed from the URL," said Najibullah Malik, secretary of Pakistan's information technology ministry, referring to the technical term for a Web page.

Facebook assured the Pakistani government that "nothing of this sort will happen in the future," said Malik.

Officials from the website could not immediately be reached for comment. They said earlier the contents of the "Everybody Draw Mohammed Day!" page did not violate Facebook's terms.

The page encouraged users to post images of the prophet to protest threats made by a radical Muslim group against the creators of the American TV series "South Park" for depicting Muhammad in a bear suit during an episode earlier this year.

The controversy sparked a handful of protests across Pakistan, many by student members of radical Islamic groups. Some of the protesters carried signs advocating holy war against Facebook for allowing the page.

Bangladesh also decided to block Facebook on Sunday but said it would restore access to the site if the offensive material was removed.

It is not the first time that images of the prophet have sparked anger. Pakistan and other Muslim countries saw large and sometimes violent protests in 2006 when a Danish newspaper published cartoons of Muhammad, and again in 2008 when they were reprinted. Later the same year, a suspected al-Qaida suicide bomber attacked the Danish Embassy in Islamabad, killing six people.

As of midmorning Monday, access to Facebook inside Pakistan was still restricted. But users outside the country confirmed the page that sparked the recent uproar was no longer accessible.

Pakistani government officials are waiting for a written court order lifting the ban before they advise Internet service providers to restore access to the site, said Malik.

Anger over the incident also prompted the government to block access to YouTube, saying there was growing sacrilegious content on the video sharing website. The government restored access to YouTube last week but said it would continue to block videos offensive to Muslims that are posted on the site.