ISLAMABAD - Pakistan blocked the social networking website Twitter for much of Sunday because it refused to remove tweets considered offensive to Islam, said one of the country's top telecommunications officials.

The tweets were promoting a competition on Facebook to post images of Islam's Prophet Muhammad, said Mohammad Yaseen, chairman of the Pakistan Telecommunication's Authority. Many Muslims regard depictions of the prophet, even favourable ones, as blasphemous.

The government restored access to Twitter before midnight Sunday, about eight hours after it initially blocked access. It was unclear whether the government reversed its decision because of action by Twitter or because of public criticism it received for its censorship.

Yaseen said Sunday afternoon that Pakistan's Ministry of Information Technology had ordered the telecommunications authority to block Twitter because the company refused to remove the offending tweets. In contrast, Facebook had agreed to address Pakistan's concerns about the competition, he said.

The ministry informed Yaseen to restore access to Twitter Sunday evening, but he did not know what led to the decision.

Twitter spokesman Gabriel Stricker said the company had not taken down any tweets or made any other changes before Pakistan stopped blocking the site. Officials from Facebook were not immediately available for comment.

A top court in Pakistan ordered a ban on Facebook in 2010 amid anger over a similar competition. The ban was lifted about two weeks later, after Facebook blocked the particular page in Pakistan. The Pakistani government said at the time that it would continue to monitor other major websites for anti-Islamic links and content.

Even when Twitter was blocked Sunday, many people based in Pakistan continued to use the website by employing programs that disguise the user's location. There was widespread criticism of the government's action by those on Twitter, who tend to be more liberal than average Pakistanis.

"Another cheap moral stunt by Pakistan," tweeted liberal Pakistani columnist Nadeem Paracha.

The 2010 Facebook controversy sparked many in Pakistan's liberal elite to question why Pakistanis could not be entrusted to decide for themselves whether or not to look at a website. Some observers noted that Pakistan had gone further than several other Muslim countries by banning Facebook, and said it showed the rise of conservative Islam in the country.

There were a handful of protests against Facebook back in 2010, often organized by student members of radical Islamic groups. Some of the protesters carried signs advocating holy war against the website for allowing the competition page to be posted in the first place.