A Pakistan High Court ordered the government on Wednesday to restore access to social media platform X within a week, a lawyer said, after more than two months of disruptions.
The platform, formerly known as Twitter, has been rarely accessible since February 17, when jailed former prime minister Imran Khan's party called for protests against a government official's admission of vote manipulation in the February election.
Pakistan's communications authority later acknowledged in court papers that it had been ordered by the Interior Ministry to shut the site down.
"The Sindh High Court has given the government one week to withdraw the letter, failing which, on the next date, they will pass appropriate orders," Moiz Jaaferi, a lawyer challenging the ban, told AFP.
The court's decision is expected to be published in the coming hours.
The Interior Ministry said X was blocked on security grounds, according to a report submitted to Islamabad High Court in a separate challenge to the shutdown and shared with media.
"It is the sole prerogative and domain of the federal government to decide what falls within the preview of terms of 'defence' or 'security' of Pakistan and what steps are necessary to be taken to safeguard National Security," said the report, submitted by Interior Secretary Khurram Agha.
Both the government and the Pakistan Telecommunication Authority (PTA) had for weeks refused to comment on the outages.
The interior ministry suggested intelligence agencies were behind the order.
The closure of a social media service "when there is request from any security or intelligence agency" is "well within the scope of provisions of the PTA act", the report said.
Digital rights activists said it was designed to quash dissent after February 8 polls that were fraught with claims of rigging.
"The X block seems to be intended to discourage the democratic accountability that a platform with instant updates of real time information enables, especially at a time when a controversial election with strong allegations and evidence of rigging surfaced," expert Usama Khilji told AFP.
Access to X has been sporadic, occasionally available for short cycles based on the internet service provider, forcing users to use virtual private networks.
Mobile internet services were cut across Pakistan on election day, with the interior ministry citing security reasons.
It was followed by a long delay in issuing voting results, giving rise to allegations of rigging.
Khan's opposition party had already faced heavy censorship in the weeks before the election, banned from television channels and from holding rallies, forcing its campaign online.
Despite the crackdown, his party won the most seats but were kept from power by a coalition of rival parties that had the backing of the military.