SAN FRANCISCO -- YouTube, the video website owned by Google (GOOG), said Wednesday it would not remove a film clip mocking the Islamic Prophet Muhammad that has been blamed for anti-U.S. protests in Egypt and Libya, but it has blocked access to it in those countries.

The clip, based on a longer film, depicts the prophet as a fraud and philanderer and has been blamed for sparking violence at U.S. embassies in Cairo and Benghazi. The U.S. Ambassador to Libya, J. Christopher Stevens, and three other American diplomats were killed in an attack on the U.S. embassy in Benghazi on Tuesday.

"This video -- which is widely available on the Web -- is clearly within our guidelines and so will stay on YouTube," Mountain View-based Google said in a statement. "However, given the very difficult situation in Libya and Egypt, we have temporarily restricted access in both countries. Our hearts are with the families of the people murdered in yesterday's attack in Libya."

The 14-minute clip is a trailer for a film called the "Innocence of Muslims," produced by a man who described himself as a California-based Israeli Jew named Sam Bacile.

Google has generally adopted a hands-off approach to political speech, although its "community guidelines" prohibit "hate speech," including speech that attacks or demeans a group based on religion.

"We work hard to create a community everyone can enjoy and which also enables people to express different opinions," Google said in its statement. "This can be a challenge because what's OK in one country can be offensive elsewhere."

In the past, Google has selectively filtered videos that violate local laws.

On Wednesday, Afghanistan's general director of Information Technology at the Ministry of Communications, Aimal Marjan, told Reuters, "We have been told to shut down YouTube to the Afghan public until the video is taken down."