The question is whether that finding must have a factual basis before it is declared.  The data on terrorism in the United States consistently indicates that the threat largely lies elsewhere. Judge Robart made that point in his ruling. 

Alex Nowrasteh, an immigration expert at the libertarian Cato Institute, has arrived at a striking finding: Nationals of the seven countries singled out by Trump have killed zero people in terrorist attacks on U.S. soil between 1975 and 2015. Trump’s action “is a response to a phantom menace.” 3 Americans have been killed in attacks committed by refugees—all by Cuban refugees in the 1970s. Zero by Syrian refugees.

Contrary to Trump's claims Obama did not ban people from the seven listed countries. The Obama administration and Congress had previously designated them as places people couldn’t visit if they planned to participate in the U.S. visa-waiver program.