Pakistan's former Prime Minister Imran Khan speaks during a news...

Pakistan's former Prime Minister Imran Khan speaks during a news conference at his home, May 18, 2023, in Lahore, Pakistan. On Monday, July 1, 2024, a United Nations human rights working group called for the immediate release of Pakistan’s imprisoned former Prime Minister Khan, saying he had been detained “arbitrarily in violation of international laws.” Credit: AP/K.M. Chaudary

ISLAMABAD — A Pakistani court on Saturday overturned the convictions and seven-year sentences of former Prime Minister Imran Khan and his wife, but officials quickly moved to prevent his release from prison.

The acquittal in a case relating to the legality of the couple's 2018 marriage seemed to have removed the last hurdle in the way of Khan's release, nearly a year after he was jailed, and his followers had started gathering near the prison where he was being held in the garrison city of Rawalpindi to greet him on his release.

But shortly after the court's ruling, Khan was arrested yet again, in connection to riots last year, his party said. It added that it believed Khan’s wife, Bushra Bibi, was also being arrested again, in a lingering corruption case.

Authorities have registered multiple cases against Khan since 2022 when he was ousted from power through a vote of no-confidence in the parliament. Khan has been embroiled in more than 150 legal cases, including inciting violence, since his initial arrest in May 2023.

Earlier this month, the United Nations human rights working group called for Khan's immediate release, saying he had been detained “arbitrarily in violation of international laws."

Saturday's acquittal relates to Khan's marriage to Bibi, his third wife. She was previously married to a man who claimed that they divorced in November 2017, less than three months before she married Khan. Islamic law, as upheld by Pakistan, requires a three-month waiting period before a new marriage.

Bibi had said they divorced in August 2017 and the couple insisted during the trial that they did not violate the waiting period.

Following Khan's arrest in May 2023, Khan’s supporters attacked military and government buildings in various parts of the country and torched a building housing state-run Radio Pakistan.

The violence subsided only when Khan was released by the Supreme Court. However, he was again arrested in early August 2023 after a court handed him a three-year jail sentence for corruption.

In recent months, Khan has been acquitted in several cases relating to last year’s violence, but his bail was canceled this week in connection with one such case that was pending against him in the eastern city of Lahore.

Khan’s party said it plans to approach higher courts to get bail for him.

The latest development came a day after Pakistan’s Supreme Court ruled that Khan's Tehreek-e-Insaf party was improperly denied at least 20 seats in parliament, in a significant blow to the country’s fragile governing coalition.

Khan’s Pakistan party was previously excluded from a system that gives parties extra seats reserved for women and minorities in the National Assembly, or lower house of the parliament. Though the verdict was a major political win for Khan, it would not put his party in a position to oust the government of Prime Minister Shehbaz Sharif, who came into power following a Feb. 8 election that Khan allies say was rigged.

NewsdayTV has you covered Credit: Newsday

Everything you need to know about Election Day and more from NewsdayTV