ISTANBUL—Turkey's parliament passed a bill that would allow authorities to shut websites without a court ruling, in a move critics slammed as an effort by Prime Minister Recep Tayyip Erdogan to silence dissent and expand his media control.

Lawmakers led by the premier's Justice and Development Party, or AKP, approved the measure late Wednesday, despite charges that it would significantly curtail free speech and intrude on personal freedoms.

The law, which must be approved by President Abdullah Gül to take effect, would allow the agency charged with monitoring telecommunications to block access to Internet sites within four hours of receiving complaints about privacy violations. Turkey's web hosts would also have to store all traffic information for up to two years, according to the measure.

"The approach that the Internet is being banned, is being censored is wrong," Transport, Maritime Affairs and Communications Minister Lutfi Elvan said Thursday. The measure will prevent infringement of personal rights by bypassing lengthy court procedures that failed to protect privacy in a timely manner, he said.

The prime minister's spokesman couldn't be reached for comment.