By Emre Peker

ISTANBUL--Turkey's top court ruled on Thursday that a two-month YouTube ban is unconstitutional, paving the way to lift the blockade after the government cut off access to Google Inc.'s video-sharing website for publishing leaked state secrets just days before the country's critical March elections.

The Constitutional Court in Ankara sided with individual appeals filed by Google's local attorney, opposition lawmakers and the Union of Turkish Bar Associations in its decision, ruling that YouTube's blockade breached their rights, according to state-run Anadolu news agency.

Judges will now write up their detailed decision and send it to Turkey's telecommunications watchdog, known as TIB, and the Transport, Maritime Affairs and Communications Ministry for the authorities to implement their ruling, and lift the ban.

The YouTube blockade started on March 27, just hours after a two-part voice recording surfaced on the website that purportedly disclosed a top-secret conversation about a potential attack against rebels inside war-torn Syria, just across Turkey's southern border. The alleged recordings involved high-ranking officials, including Foreign Minister Ahmet Davutoglu and the spy agency chief, Hakan Fidan.

A week before banning Google's video-sharing website, Turkish authorities had blocked microblogging siteTwitter Inc. Turkey's top court overruled that blockade as unconstitutional as well, freeing the site on April 3.

Write to Emre Peker at emre.peker@wsj.com

Subscribe to WSJ: http://online.wsj.com?mod=djnwires