Pakistan announced on Monday that it was restoring YouTube access in the country, after Google created a Pakistan-specific version of its video platform that allows authorities to censor content on the site.
YouTube was blocked in Pakistan in 2012 after the posting of an inflammatory video, Innocence of Muslims, sparked violent protests across the Muslim world.
The three-year ban has been one of the site's most high-profile outages, alongside its legal battles in Turkey.
Pakistan's government on Monday ordered the country's telecom regulator to lift a ban on YouTube within 48 hours, a senior Pakistani official told the Financial Times.
"We have reached an understanding with YouTube so that material considered offensive will not be shown in Pakistan," he said.
Under the agreement, the Pakistan Telecom Authority will be able to ask YouTube to remove any material it deems offensive, the government said in a statement.
YouTube maintains more than 85 country-specific sites around the world in order to showcase local content, and in some cases to comply with local censorship laws.
More from The Financial Times :
In Google's most recent transparency report, the company said that YouTube received more than 12,000 takedown requests from governments during the second half of 2014.
The company said it had complied with about half of these demands.
Western diplomats said the ban had become irrelevant as many users in Pakistan had found ways to access YouTube using proxy servers.
"Many users were able to successfully access YouTube so what was the point [of] keeping the ban," said one.
YouTube and other US sites including Facebook have faced periodic blocks in Pakistan over content that is deemed to be blasphemous.
The film, which sparked the ban and caused riots across the Muslim world, was a crude piece of propaganda against the Prophet Mohammed.
After the attacks, YouTube removed the video from its site in Egypt and in Libya, but it remained uploaded in other countries.
Protests in Pakistan over the film grew so large that the US government ran advertisements on local television denouncing the film, hoping to quell the violence.