The Turkish government’s block on Wikipedia is a violation of freedom of expression, the country’s high court has ruled, paving the way for the two-year-old ban to be lifted.

The justices of the Turkish constitutional court voted 10-6 in favour of Wikipedia, state-run news agency Anadolu reported on Thursday, ordering the ban to be lifted with immediate effect.

The ruling was welcomed by Jimmy Wales, the site’s founder, who tweeted a picture of himself on a previous trip to Istanbul along with the message: “Welcome back, Turkey!”

There was no immediate comment from the government and it was not immediately clear when access to the online encyclopedia would be restored.

The Turkish ban on all the various language editions of Wikipedia has been in place since April 2017 after entries on the website claimed government officials were involved in oil trading with Islamic State and accused Turkey of sponsoring Isis and other terrorist organisations.

After Wikipedia refused to remove the content from the community-maintained site, citing its opposition to censorship, Ankara said Wikipedia was part of a smear campaign against the country.

Officials said at the time that “an administrative measure” had been taken against the site, under a wide-reaching law that allows the government to censor internet content it believes poses a national security threat. Ankara gave no reason for the ban.

Wales himself was also “disinvited” from a World Cities Expo event held in Istanbul in May 2017.

The Wikimedia Foundation, the non-profit organisation that runs the site, petitioned the constitutional court in May 2017 after talks with Turkish officials and a challenge in lower courts failed.

In May this year, the foundation took Turkey to the European court of human rights in Strasbourg over the ban. A statement from the foundation said at the time that the decision to file a petition with the ECHR was taken “only after continued and exhaustive attempts to lift the block through legal action in the Turkish courts, good faith conversations with the Turkish authorities, and campaigns to raise awareness of the block and its impact on Turkey and the rest of the world”.

The ECHR has ruled against Turkey more than any other country. Ankara routinely ignores verdicts, choosing instead to pay court-ordered fines.

The ECHR expedited the case, giving Turkey until the end of the year to justify the ban on Wikipedia, calling the block “unacceptable in a democratic society and not compatible with article 10 of the European convention on human rights, which protects freedom of expression”.

The Turkish constitutional court’s new decision should avert another ECHR ruling against Ankara.

While many Turkish people use methods such as VPNs and mirror sites to circumvent blocked internet content, online censorship remains a stubborn problem for the country.

At least 127,000 websites have been banned as well as 95,000 individual web pages, and social media sites such as Facebook and Twitter are frequently temporarily blocked, usually just after protests or terrorist attacks.

Media freedoms in Turkey have steadily deteriorated during the last decade, but the crackdown has escalated since the failed 2016 coup attempt against President Recep Tayyip Erdoğan, after which dozens of media outlets were closed or taken over.