A Pakistani court has ordered the release of Hafiz Saeed, an alleged mastermind of the 2008 Mumbai terror attacks, in a move likely to worsen the country’s tattered relationship with the US.

The Islamist cleric, who heads Jamaat-ud-Dawa (JuD) – listed by the UN as a terrorist group – and has a $10m(£7.5m) US bounty on his head, is expected to be freed on Friday after less than a year in detention.

Saeed thanked the judges of Lahore’s high court in a video statement. “The lawyers of the court supported me tremendously and I am so thankful to God for that,” he said. “This is a great step for freedom for Pakistan.”

The US and India suspect Saeed of masterminding the attacks in Mumbai, in which 10 gunmen ran rampage over several days, killing 166 people. He was put under house arrest in January this year having lived in the open for years.

On Wednesday the court in Lahore rejected a request from the provincial government of Punjab for a 60-day extension to his house arrest.

A prosecutor, Sattar Sahil, told Reuters: “His previous detention for 30 days is over, which means he would be released tomorrow.”

Government officials argued that prolonging Saeed’s detention was necessary to avoid international sanctions and a halt to foreign funding to the country.

Saeed denies involvement in terrorism and claims the government punished him to pander to the whims of the US and India.

Members of JuD say it is a charity organisation, but the US says it is a front for Lashkar-e-Taiba, an anti-India jihadi group that Saeed helped found in the 1990s.

Until he was detained in January along with four aides under the country’s anti-terrorism legislation, Saeed’s freedom was a source of friction between Washington and Islamabad.

But the courts were inevitably bound to set him free at some point, said Cyril Almeida, a columnist and assistant editor at the Dawn newspaper. More significant measures were needed to repair trust between the US and Pakistan, he said.

“Band-aid solutions such as temporary detention orders may buy some time but it only delays a final reckoning. On groups such as Lashkar-e-Taiba, Pakistan and the US are on a collision course,” Almeida said.

After Barack Obama failed to persuade Pakistan to clamp down on militants plotting attacks on Afghanistan and India from inside its borders, Donald Trump has taken a more aggressive stance.

“We can no longer be silent about Pakistan’s safe havens for terrorist organisations,” Trump said when rolling out his policy for south Asia in August, declaring that Pakistan would have “much to lose” if it did not comply.

However, Trump’s sharp rhetoric was derided across the Pakistani political spectrum, with officials scoffing at the apparent lack of acknowledgement for their country’s sacrifices.

In recent months, Pakistan appears to have taken small steps to appease the US. Its armed forces conducted a successful operation to free a Canadian-American family from Taliban captivity in the tribal areas, and it seems to have silently consented to the US upping drone strikes on its territory, which reportedly have killed several prominent militants.

Meanwhile, the government has banned Lashkar-e Taiba and recently rebuffed attempts by a party affiliated with Jamaat-ud-Dawa to register in local elections in Lahore and Peshawar.

Still, followers of Saeed rallied openly in the streets in support of purportedly independent candidates, who did relatively well in both cities.

Jamaat-ud-Dawa also vies for popular support outside the ballot box, providing disaster relief and health services in places where the state is largely absent, and leading the charge for Kashmiri independence.

“I am fighting for the cause of Kashmir, which is why India is after me,” Saeed said on Wednesday. “But we shall be successful.”

Additional reporting by Nosheen Abbas