The strike occurred early Thursday after a firefight killed two US soldiers and three Afghan Special Forces during an anti-Taliban operation in Kunduz.
It was not immediately clear if the two incidents were related, but the killings highlight growing insecurity after the Taliban last month overran Kunduz city for the second time in a year.
“Afghan forces and coalition troops conducted a joint operation against the Taliban insurgents. In the bombardment 30 Afghan civilians were martyred and 25 others were wounded,” provincial spokesman Mahmood Danish told AFP.
Police spokesman Mahmoodullah Akbari gave the same toll to AFP, adding that the dead included infants aged as young as three months and other children.
“They were asleep when their house came under attack by coalition troops,” Akbari said.
In a brief statement on Twitter, NATO conceded it was behind the airstrike.
“Airstrikes were conducted in #Kunduz to defend friendly forces under fire. All civilian casualty claims will be investigated,” it said.
Emotionally-charged protests erupted in Kunduz after the airstrike, with dozens of relatives of those killed in the airstrike rallying outside the governor’s office, carrying the bodies of victims.
“I am heartbroken. I have lost seven members of my family. I want to know, why these innocent children were killed? Were they Taliban?” said Taza Gul, a 55-year-old labourer.
“No, they were innocent children.”