London (CNN) -- David Miranda, the partner of Guardian journalist Glenn Greenwald, won a partial victory in his legal action against the Metropolitan Police Thursday, but the judge left a loophole that allows the police to continue investigating the materials they seized from him on Sunday. Miranda, a Brazilian citizen, spent nearly nine hours in detention Sunday being questioned under a provision of Britain's terrorism laws, after he was stopped as he changed planes on his way home from Berlin to Brazil. Authorities confiscated Miranda's electronic equipment, including his mobile phone, laptop, memory sticks, smart watch, DVDs and games consoles.
@highlight
NEW: Police hail court's rejection of "attempt to prevent further examination of material seized"
@highlight
Court bars use of materials seized, except for purpose of protecting national security
@highlight
Lawyer for the police says a criminal investigation has been launched
@highlight
Miranda was detained for nearly 9 hours Sunday at Heathrow Airport
He doesn't work for @placeholder, but the newspaper paid for his flights because he was helping his partner.