Judge Hassouna Tawfiq ordered the Egyptian government to block access to the site as punishment for allowing users to see the film clip he described as "offensive to Islam and to the Prophet [Mohammed]".
The "Innocence of Muslims", made by an Egyptian American Christian, is a blasphemous portrayal of Islam, showing the Prophet Mohammed as a religious fraud and paedophile.
The film's 14-minute trailer, which was posted to YouTube, incensed communities around the world. Demonstrators in Cairo last Septemberscaled the US embassy's walls and tore down the American flag. The violence spread through over 20 countries, killing more than 50 people.
The lawyer who filed the case against the Egyptian government, Mohammed Hamid Salim, alleged that the film constitutes a threat to Egypt's security.
Last year YouTube's parent company, Google, declined requests to remove the video from the website. It did restrict access to some countries, including Egypt and Libya, because it said the film broke laws in those countries.