YouTube, which authorities also banned after an Istanbul court ordered social media to remove any content showing the kidnapped prosecutor, remained blocked late on Monday as talks with it continued, the official said.
Mehmet Selim Kiraz, the Istanbul prosecutor seen in the pictures, was later killed in a shoot-out between his hostage takers and police last week.
"Twitter has agreed to shut down accounts and remove images relating to last week's hostage-taking. The website will reopen to access very shortly," the senior official told Reuters before the site became accessible again.
The micro-blogging site intends to appeal the Turkish court order, an official said without giving his name.
Other social media sites were affected as well. Facebook said it had complied with a court order to restrict access to some content or face a block on its service. A company spokesman said it would appeal the order.
Late on Monday, an Istanbul court ordered Google to remove controversial content on the prosecutor killed in hostage-taking incident, otherwise access to it would be blocked also.
Ibrahim Kalin, a spokesman for President Tayyip Erdogan, said a prosecutor had demanded the bans because some media organisations had acted "as if they were spreading terrorist propaganda" in sharing the images of the hostage-taking.
"This has to do with the publishing of the prosecutor's picture. What happened in the aftermath is as grim as the incident itself," Kalin said. "The demand from the prosecutor's office is that this image not be used anywhere in electronic platforms," he told a news conference in Ankara.
Far-left captors
Prosecutor Kiraz died from his wounds last Tuesday after security forces stormed the office where members of the far-left Revolutionary People's Liberation Party-Front (DHKP-C) had taken him hostage. His two captors were also killed.
The DHKP-C had published a picture of Kiraz with a gun to his head and said it would kill him unless its demands were met.
"The wife and children of prosecutor Kiraz have been deeply upset. The images are everywhere," the Turkish official said.
Google said it was working to restore service to the YouTube video-sharing site, which it owns. Turkey's telecoms regulator could not immediately be reached and there was no statement on its website.
Turkey temporarily blocked Twitter and YouTube before local elections in March 2014, after audio recordings purportedly showing corruption in then-Prime Minister Erdogan's inner circle were leaked on their sites. That decision caused a public uproar and drew heavy international criticism.
Turkey filed over five times more content-removal requests to Twitter than any other country in the second half of 2014, data published in February by the micro-blogging site showed.
Last year, Turkey tightened laws allowing sites to be blocked by the authorities more easily.
© Thomson Reuters 2015
For the latest tech news and reviews, follow Gadgets 360 on X, Facebook, WhatsApp, Threads and Google News. For the latest videos on gadgets and tech, subscribe to our YouTube channel. If you want to know everything about top influencers, follow our in-house Who'sThat360 on Instagram and YouTube.