The Federal High Court has granted the State Security Service an approval to keep Omoyele Sowore in custody for initial 45 days.
Taiwo Taiwo of the Abuja Division also said the SSS would get additional permission to keep locking Mr Sowore up for his activism.
Mr Sowore had called for a good governance revolution in Nigeria last week, drawing immediate fears from President Muhammadu Buhari and other elements in his government.
Mr Sowore was arrested in Lagos on August 3 by SSS operatives who stormed his apartment.
The arrest came two days before the nationwide protest was scheduled to take place on August 5 across the country.
After keeping Mr Sowore in custody for more than 48 hours in violation of the law, the SSS asked a federal judge for permission to further incarcerate him and was granted on Thursday morning.
Despite the SSS admitting that it had no evidence of a plot to take over government against Mr Sowore, the judge still granted the secret police permission to keep him under the anti-terrorism law.
The remand order was granted ex-parte, meaning Mr Sowore was not allowed to be represented by a lawyer and the judge took the decision based on only the claim of the SSS.
The judge, Taiwo Taiwo, ruling on an ex parte application filed by the SSS, whose operatives arrested Mr Sowore on August 3 in Lagos, held that the detention order would be renewable after the expiration of first 45 days on September 21.
The SSS had on Tuesday applied for permission to keep Mr Sowore for 90 days to investigate him over his call for revolution ahead of the RevolutionNow protests which held in some parts of the country on Monday.
The security agency anchored its application on the provision of section 27(1) of the Terrorism (Prevention) Amendment Act.
Ruling on ex parte application, a one-sided request by the SSS without counter-argument by Mr Sowore's legal team, Mr Taiwo, said he had to grant the application, "only to the extent" of allowing the security agency to keep the respondent in custody for only 45 days for the applicant to conclude its investigation.
Mr Taiwo said, although the hearing of the application was one-sided as provided by 27(1) of the Terrorism (Prevention) Amendment Act, the use of the word, "may", in the provision "is directory" and not "discretionary".
He said he would, therefore, be failing in his duty not to grant the request for a detention order.
He also said should the applicant require more time to conclude its investigation after the expiration of the first 45 days, it had the liberty to apply for its renewal.