ISTANBUL — A court in Turkey ruled on Wednesday that the government could not ban Twitter, as it sought to do five days ago, and ordered the country’s telecommunications authority to restore access to the service. The action by the government had been met inside and outside the country with an uproar about respect for freedom of expression.

It was not immediately clear whether the ruling would be appealed or overtaken by a new court order.

The court in Ankara, the capital, ruled in response to complaints by Turkey’s bar association and its journalists’ union, arguing that the attempt to block Twitter contravened the freedom of information and communication. The prohibition has been widely bypassed by Twitter users, who have reached the service through alternative channels.

The telecommunications authority imposed the ban on the ground that Twitter refused to remove content that violated personal privacy. But government critics had used Twitter to publicize leaked recordings of telephone conversations that were said to show widespread corruption among government officials and people close to Prime Minister Recep Tayyip Erdogan, including his son. Mr. Erdogan said his adversaries had fabricated the recordings.