US court rules NSA surveillance uncovered by Edward Snowden is illegal