ISTANBUL — Just hours after the prime minister of Turkey threatened to shut down Facebook and YouTube, the country’s president voiced reassurance on Friday that reversing course on civil liberties was “out of the question.”

Prime Minister Recep Tayyip Erdogan vowed Thursday night to restrict social media after local elections this month, despite harsh reactions worldwide to a crackdown that has included a law, approved in February, tightening government control of the Internet.

“There are further steps we’re preparing to take after March 30,” the election date, Mr. Erdogan said in a live broadcast by the pro-government channel ATV.

“Some are talking about YouTube, Facebook, this and that, ‘What would the world say?’ and all that,” Mr. Erdogan continued. “Some of my friends and I remain determined about this; we will not allow this nation to be devoured by YouTube, Facebook or whatever. We will take necessary steps in the firmest way.”