Lawmakers in Turkey passed a law Wednesday requiring social media companies to appoint a “representative” to respond to government demands for censorship, a push President Recep Tayyip Erdogan vowed would occur after social media users mocked his newborn grandchild.

Erdogan’s Islamist Justice and Development Party (AKP), the majority in the Turkish Parliament, pushed the law through with the help of its usual ally, the minority Nationalist Movement Party (MHP). According to the state-run Anadolu news agency, the law “sets a formal definition of social media providers and aims to designate a responsible representative for investigations and legal proceedings relating to offenses on platforms.” The law will take effect on October 1.

The law requires international social media networks with over one million Turkish visitors daily — companies like Twitter and Facebook — to appoint a special representative to the Turkish government so that Erdogan has a direct line to them and can easily demand the erasure of content he disagrees with. The representative will also presumably be responsible for content that violates Turkish law, such as insults against the president or insults against Mustafa Kemal Atatürk, the founder of the Republic of Turkey (both are crimes). Any individual representing the country must be a Turkish citizen, which would protect Ankara from creating any international turmoil if police arrest them for alleged violations of the law.

“Social network providers would have 48 hours to respond to orders to remove offensive content,” Anadolu added. “Providers will also take necessary measures to store data on users in Turkey inside the country.”

Human Rights Watch issued a statement on Monday prior to the law’s passage warning that it would “greatly increase online censorship, particularly in light of the country’s poor record on freedom of expression.”

“It is essential for everyone who values and champions free speech to recognize how damaging these new restrictions will be in a country where an autocracy is being constructed by silencing media and all critical voices,” Tom Porteous, deputy program director at Human Rights Watch, said in the statement. “Social media companies should loudly and unequivocally call on Turkey to drop this law, and the EU should resolutely back this call.”

Erdogan heavily cracked down on national media in the aftermath of the failed coup against his government in 2016, which he blamed, without evidence, on Pennsylvania Islamic cleric Fethullah Gülen. Erdogan ordered police to shut down any media outlets suspected of being “Gülenist,” resulting in the immediate end of operations for 131 media outlets that year. In addition to those shut down, Erdogan seized opposition newspapers like Zaman, turning them into state propaganda outlets, or otherwise ensured the ownership of newspapers like Hurriyet, once reliably moderate in its coverage, fell into the hands of personal friends.

The law barreled through the Turkish parliament at high speed, a response to Erdogan’s public outrage on July 1 that some on social media had made jokes about the birth of his latest grandchild, born of his daughter and Turkey’s Finance Minister. Users reportedly joked that the child was not related to the finance minister, implying infidelity on the part of Erdogan’s daughter. The jokes prompted Erdogan to declare social media in general un-Turkish and threaten laws to punish those who would speak freely about him and his family on those platforms.

“Do you understand why we oppose Youtube, Twitter, Netflix, and other social media platforms? It is to get rid of immoral actions. It is imperative that these channels are brought under control,” Erdogan asserted. “These sorts of platforms are not convenient for our nation and country. For this reason, we will take them to the parliament as soon as possible in order to completely remove and control such social media platforms.”

Police later arrested 11 people for unsavory posts about the president’s grandchild. Turkey also subsequently censored an attempted Netflix original series produced in Turkey because writers had included an LGBT character in the story, prompting Netflix to cancel the project entirely rather than erase the character from the story to appease Ankara.

Erdogan’s targeting of Netflix, which is not typically used as a base for public commentary but rather for streaming films and television, triggered mockery from the nation’s secularist opposition.

“If you [Erdoğan] close Netflix before the end of Dark‘s last season, I will be offended,” İYİ (Good) Party leader Meral Akşener tweeted at the time, referring to a popular Netflix original series from Germany. When Parliament addressed Erdogan’s proposed law this week, opposition members apparently did not do enough to stop it.

The largest opposition party — the secularist Republican People’s Party (CHP) — announced shortly after the bill passed that it would take it to the nation’s Constitutional Court to challenge its violations of free speech.

“This law proposal is a law proposal that applies censorship to social media. A law proposal that restricts the freedom of our youth. A law proposal that wants to eliminate the voice of people who want to oppose [the government],” Engin Özkoç, CHP deputy chairman, said, according to one of the few remaining anti-Islamist newspapers in Turkey, Cumhuriyet.

Follow Frances Martel on Facebook and Twitter.