U.S. judge rejects Trump’s justification for terminating thousands of grants

States hail decision, but White House may try other ways to end funding