A Turkish court ordered net firms to block access to social media sites to stop the sharing of photos of a hostage taken during a recent armed siege.
Two gunmen reportedly from a far-left group took a prosecutor hostage at an Istanbul courthouse. All three died.
Facebook, Twitter, YouTube and more than 150 other sites were affected.
The block on Facebook has been lifted and the one on Twitter is about to be lifted after they both complied. Talks with YouTube are continuing.
Before imposing the blocks on the websites, Turkish authorities had moved to stop newspapers printing the images.
The newspapers were accused by the government of disseminating “terrorist propaganda” for the DHKP-C group that was reportedly behind the attack on the courthouse. The DHKP-C is considered a terrorist group by Turkey, the European Union and US.
The siege ended with the gunmen and their hostage being killed when police stormed the building in a rescue bid.
The prosecutor at the centre of the siege, Mehmet Selim Kiraz, was apparently taken hostage because he headed an investigation into the death of a boy during anti-government protests that took place in 2013.
Analysis: Selin Girit, BBC News, Istanbul
Millions of social media users have tried to post comments or videos on their favourite platforms but with no success.
But the ban has not stopped people from tweeting. Newspapers and individuals alike have shared guidelines on how to circumvent the ban.
The hashtag #TwitterisblockedinTurkey became the number one trending topic worldwide.
The Turkish government is not a fan of social media platforms. Last year, just before the local elections, access to Twitter and YouTube were also banned.
The then prime minister, now President Recep Tayyip Erdogan, said that Twitter was a menace to society.
With the general elections to come on 7 June and tensions running high, many people fear similar bans on social platforms could follow.
The pictures showing attackers holding a gun to Mr Kiraz’s head were being widely shared on social media, leading authorities to act, reported Turkish newspaper Hurriyet.
“The wife and children of prosecutor Kiraz have been deeply upset. The images are everywhere,” a senior Turkish official told the Reuters news agency.
In total, 166 websites which shared the images were blocked by the court order.
YouTube published the text of the court ruling on its website saying an “administration measure” had been enacted by Turkey’s telecoms authority. It said it was seeking ways to restore access.
Facebook was also subject to the same block but it is believed the restrictions on it were lifted because it removed the images before the expiration of a deadline imposed by the court. Twitter reacted more slowly and access to the messaging system was blocked for several hours on Monday.
Many Turkish people reported via social media that they were having problems accessing the three big net sites as well as many other net services.
This is not the first time that Turkish authorities have imposed blocks on social media sites and networks.
In the run-up to local elections in March 2014 blocks were imposed after recordings circulated allegedly revealing corruption among senior officials.
Figures provided by Twitter revealed that Turkey filed more requests to remove content from the social network than any other nation between July and December 2014.