A court said the president has the legal power to order the indefinite detentions of civilians captured in the U.S.