The suspected mastermind of the 2008 militant attacks on Mumbai that killed 166 people has won an appeal against his detention in Pakistan.

The Islamabad High Court ruled Monday that Zaki-ur-Rehman Lakhvi could be freed on about $10,000 bail, a ruling that drew an immediate rebuke from India. The Indian government summoned Pakistan's envoy to protest.

Lakhvi was not immediately freed, but some analysts said he could be as soon as paperwork is completed.

Earlier this month, a different Pakistani court granted Lakhvi bail, but Pakistani authorities ordered his continued detention under a public order law. It was that decision that Lakhvi's attorneys successfully contested.

Lakhvi is one of seven Pakistani suspects who have been charged with planning and financing the attacks in India's commercial capital, which have been blamed on the banned Pakistani militant group Lashkar-e-Taiba. India has long been angered by Pakistan's failure to either hand over the suspects or prosecute them.

Indian Prime Minister Narendra Modi called the bail order "a shock to all those who believe in humanity world over."