A Pakistani court ordered the releases months ago and there was no appeal of that ruling. Khan on Wednesday announced his government would implement a plan for the releases.
According to this very article, the PM exercised this power based on a ruling of the judiciary.