Pakistan 'failed' mentally ill death row inmate, Supreme Court told