The operation was conducted together with the national intelligence and security authority, PET, Jorgen Bergen Skov said.
"You must have no doubt that PET's efforts helped avert a terrorist attack", he told reporters.
The suspect will appear in court behind closed doors on Friday. He is accused of having tried to illegally obtain weapons and ammunition and is believed to have been motivated by Islamist ideology.
In early March, the Danish authorities announced the shutdown of schools, universities and all public places in the country due to the outbreak. Gatherings of more than 10 people were also banned, and citizens were urged to stay home and not to get out unless it was urgently needed.