A federal judge blocked US President Donald Trump's executive order restricting birthright citizenship, dealing a setback to the administration.