The court based their ruling on two facts.

Trump publicly promised on several occasions to "ban Muslims".

Trumps lawyers also failed to provide sufficient evidence to support his travel ban from those countries that would override his racist statements.

Frankly the travel ban would have probably been reinstated if Trump didn't publicly blather every thought that enters his head.

This kind of makes me glad he does.