Turkey's top court ruled that a much criticised Twitter ban, imposed last month by Prime Minister Recep Tayyip Erdogan, violates the right of freedom expression and demanded access to the social media be restored.

The Constitutional Court in Ankara said the block breached the country's constitution which grants everyone "the right to express and disseminate his thoughts and opinion by speech, in writing or in pictures or through other media, individually or collectively", Hurriyet newspaper reported.

The court said it forwarded the verdict to the Turkish Telecommunications Authority (TİB) but it was not immediately clear when Turkish netizens will be able to tweet again.

Turkey blocked access to Twitter in March, after Erdogan vowed to "eradicate" social media platforms in the country.

TİB said it had engaged in the drastic measure to protect "private life privacy" after the microblogging website ignored several Turkish court orders to withdraw online content.

The ban was implemented days before crucial local elections, when links of audio recordings and documents implicating Erdogan and other top officials in corruption were circulated online.

The government later blocked access to YouTube after a leaked audio recording of a secret government security meeting was posted.

Erdogan's ruling AKP party recorded sweeping victories in municipal elections over the weekend.

Allegations of election fraud circulated on social media, with some complaining that electricity blackouts in the Ankara and other cities disrupted vote-counting. The outages were blamed on a cat by Turkey's energy minister Taner Yildiz.

Thousands of protesters from the main opposition party, the secular, Republican People's Party (CHP), demanded a recount in the capital claiming their ballots were fraudulently miscounted. They were faced by riot police.