The Turkish high court ruled on Thursday that the country’s move to block Wikipedia violated freedom of expression, paving the way for a two-year-old ban on the website to be lifted.

The judges of Turkey’s Constitutional Court voted 10-6 in favour of revoking the block on the online encyclopedia, ordering the ban to be lifted immediately. A local court is due to decide whether the ban will be lifted, according to Turkish media reports.

The ban was brought in April 2017, after the site refused to remove content that described Turkey was described as a "sponsor country" for terrorist groups Al Qaeda and ISIS.

The country’s government used a law that allows it to ban any website that it deems a national security threat.

Turkish officials said at the time the measure was needed as Wikipedia had failed to remove content linking it to terror organisations, which it deemed false.

Wikimedia Foundation, Wikipedia’s non-profit parent organisation, took legal action but lost its appeal to reverse the court’s decision. In May, the foundation said it would take the ban to the Strasbourg-based European Court of Human Rights.

Wikipedia founder Jimmy Wales tweeted a photo of himself on a trip to Turkey on Thursday, where he said: “Welcome back, Turkey!”

Since the ban came into effect, Mr Wales has himself had invitations withdrawn from Turkey. In May 2017, Istanbul authorities cancelled an invite for the Wikipedia founder to attend a major conference in the city. Although the municipality didn’t provide a reason for why Mr Wales was taken off the agenda, Anadolu news agency said that the action was taken after Wikipedia failed to respond to requests from Turkey to remove the articles linking the country to terrorists.

The court ruling will be seen by some a win for advocates of free speech.

Media freedom within Turkey has slowly deteriorated over the last few years, but the decline intensified after a crackdown by President Recep Tayyip Erdogan following a failed coup attempt in 2016, where several media outlets were closed.

Christophe Deloire, general secretary of Reporters Without Borders, welcomed Thursday’s ruling.

Constitutional Court rules that Turkey's block on Wikipedia violates rights: a highly positive decision in a country where so many journalists are jailed in "visible prisons", whereas the public is sometimes jailed in technological "invisible prisons".https://t.co/KG32QuO2bH pic.twitter.com/G4l2KF6Drt — Christophe Deloire (@cdeloire) December 26, 2019

Writing on Twitter, he said: "A highly positive decision in a country where so many journalists are jailed in 'visible prisons', whereas the public is sometimes jailed in technological 'invisible prisons'," he wrote on Twitter.