The attack was the deadliest by the Taliban for several weeks.
Dozens of people, many of them children, were killed or wounded after Afghan Air Force helicopters struck a madrassa in Dashte Archi district, security sources and witnesses told AFP.
The fall of Khawaja Omari to the Taliban extends their territory closer to the provincial capital, also called Ghazni, a city of 150,000 people 150 km (95 miles) southwest of the Afghan capital, Kabul.
"Afghan civilians continue to suffer, caught in the conflict, in ways that are preventable; this must stop now", said Ingrid Hayden, the Secretary-General's Deputy Special Representative for Afghanistan.
The militants also set off an improvised explosive device (IED) and fired a rocket on responding police unit that arrived at the scene, resulting a police commander killed and four police officers wounded, the official added.
Real Madrid escapes Juventus to advance in UCL
Ronaldo made no mistake from the spot to settle the tie but the Portuguese ace was sympathetic to Buffon after the game. Real Madrid deserved to go through over the two legs.
The district governor Ali Dost Shams was killed in the attack along with 15 security force members and civilians. Fifteen security forces were killed.
Ghazni's Khawaja Omari district was considered one of the province's safest districts.
The attack began at about 2 a.m. local time (4:30 p.m. ET on Wednesday) when Taliban fighters attacked the district and police headquarters in Khwaja Omari district, said the Ghazni provincial governor's spokesman, Mohammad Arif Noori.
Around 45 insurgents were also killed and several others wounded, he said, adding: "Taliban have set alight the district office complex, but reinforcement arrived at the district and now the situation under control". Nine other security personnel were also wounded.