Wendy Sharp, head of state secondary, John Port School, in Etwall, Derbyshire. said: "This is not normal procedure but the police assured us three times that they were acting within the law."
And she rejected suggestions the school had called police in specifically to search the pupils.
She said that last Thursday, officers came to her with "community intelligence" about a possible drug problem and she agreed to their request to search specific pupils.
The boys, aged 15 and 16, were taken by police officers to a private room and ordered to remove their uniform. The officers then checked their underwear. Two boys – aged 15 and 16 – were arrested over the discovery of suspicious substances.
Officers said they were acting within the law, but angry parents condemned their actions. Their families only became aware of what had happened when they were phoned by staff. Mrs Sharp, described as an exceptional headteacher by Ofsted, said the school did not have a particular problem with drugs.
But she told parents: "We don't want drugs in our school and you cannot be serious about tackling drugs unless you are prepared to work with the police on the issue."
Police said the decision not to warn parents was taken in case it "adversely affected the operation'"
They said the children were searched by one officer in the presence of a second officer and an "appropriate adult", thought to be the school's assistant head. All were male.
The mother of one of the boys searched, who was not arrested, said: "He's very embarrassed. I feel my child has been victimised.
"For police to actively go into the school and physically strip-search your child without your permission or knowledge, I'm outraged as I'm sure any parent would be."
Margaret Morrissey, founder of lobby group Parents Outloud, demanded clearer guidance for schools and police in the battle against drugs.
"It's absolutely tragic this is happening in our schools," she said.
"But I don't believe you can physically strip-search pupils without their parents knowing or being present. I can understand why they have done it, but it does not give them the right to bypass parents.
"It seems strange that parents were not contacted, or collected and brought into the school, before these searches took place.
"They have got to be told it's happening as they are legally responsible for them."
Inspector Paul Cannon of Derbyshire Police told BBC Radio Derby: "We had very specific intelligence about how the drugs were being brought into the school and the fact they were being brought in in the children's underwear.
"We have a duty to investigate criminality and, particularly with drugs, protect vulnerable people from coming into contact with these drugs."