Turkey has restored access to online encyclopedia Wikipedia after the official publication of a Constitutional Court ruling that the more than two-year block was a violation of freedom of expression.

The detailed version of the ruling published in the Official Gazette on Wednesday opened the way for an end to the ban put in place in April 2017.

Ankara has accused Wikipedia of being part of a "smear campaign" against the country, after the website refused to remove content that allegedly portrayed Turkey as supporting the Islamic State of Iraq and the Levant (ISIL or ISIS) group and other organisations.

More:

Wikimedia Foundation, the nonprofit organisation that hosts Wikipedia, had applied to Turkey's highest court to challenge the block.

Initially announcing its decision in December, the court said it had ruled "that freedom of expression, which is under the protection of the 26th clause of the Constitution, had been violated."

Access to the website has been restored after the ruling, passed by a 10-to-six majority in the court, was conveyed to the telecommunications watchdog.

Many Turks found ways to circumvent the ban on Wikipedia and other blocked websites.

191226164029936

The independence of Turkey's judiciary has been hotly debated in recent years, with critics saying court rulings are influenced by politicians.

Rights groups and Turkey's Western allies have regularly criticised the erosion of free speech in the country, especially since a failed coup attempt in 2016 triggered a crackdown and purges in state institutions.

President Recep Tayyip Erdogan and his ruling party deny the charges, saying the judiciary makes its decisions independently.

The government also says that the purges and detentions are in line with the rule of law and aim to remove coup supporters from state institutions and other parts of society.