Several casualties as religious school in Taliban stronghold attacked by Afghan forces, officials and witnesses say.

An air attack by Afghan forces on a gathering at a religious school in a Taliban stronghold has caused multiple casualties, including civilians, Afghan officials and witnesses said.

Top Taliban commanders were gathered inside the madrasa, where a graduation ceremony was under way for students at the time of the attack on Monday in the northeastern province of Kunduz, a security source told AFP news agency.

He said an unknown number of civilians were among the casualties that also included senior Taliban commanders who were "planning for the next spring operations".

"Several dead and at least 15 wounded", including children, who were taken to the regional hospital in the provincial capital Kunduz, Dr Naim Mangal told AFP.

Relatives of the wounded told an AFP photographer at the hospital that the attack happened during a graduation ceremony at the madrasa in Dashte Archi district, which is controlled by the Taliban.

"When the planes came at around 12:00 pm some kids screamed 'they will drop a bomb' but the elders said 'calm down, nothing is going to happen', but then in an instant bombs hit the mosque," Mohammad Ishaq told AFP.

It was not clear if the madrasa was inside the mosque or if it was a separate building.

Ishaq said civilians, students and some Taliban members, who had been invited to attend the ceremony, were inside the mosque at the time of the attack. There were three air attacks which "destroyed" the building, he added.

"I escaped unhurt but many people were killed and injured and I saw their bodies laying on the ground," he said.

The Taliban issued a statement confirming the attack on the madrasa, but denied its fighters had been meeting at the school.

Around 150 religious scholars and civilians - most of them children - were among the dead and wounded, the group added.

Several boys with their arms and legs bandaged were seen laying in beds and along the corridors of the hospital.

The security source said the Taliban had started meeting at madrassas in the hope of avoiding air attacks.

'No civilians killed'

A defence ministry spokesman confirmed an air attack in Dashte Archi, but described the location as a kind of Taliban "training centre" and denied civilians were among the casualties.

"Twenty Taliban, including the commander of their Red Unit in the district, and also a key member of the Quetta Shura were killed," Mohammad Radmanish said.

The Red Unit is the armed group's elite unit, and the Quetta Shura is its leadership council.

The same numbers were wounded, Radmanish added.

The meeting included a "high-ranking Taliban delegation" from the Quetta Shura, Ghulam Hazrat, a spokesman for the 20th army division in Kunduz, told AFP.

"Fifteen Taliban were killed and 10 were wounded," Hazrat said. He also denied civilians were among the casualties.

A senior local official said "around 150" people had been killed and wounded in the air raid.

Afghan officials often had given conflicting casualty figures after an attack.

Obtaining detailed information is difficult because the Taliban controls the area. Most telecommunication services are cut from late afternoon on Taliban orders, locals say.

A spokesman for US Forces said they were not involved in Monday's air attack.

Afghanistan's fledgling air force has accelerated bombardments in recent months as the Americans beef up the country's aerial capability with more aircraft and better weapons.

Earlier this month, the Afghan Air Force dropped its first laser-guided bomb on a Taliban compound in the western province of Farah, where the armed group has gone on the offensive.

US and Afghan forces are increasing ground and air offensives against Taliban and the Islamic State of Iraq and the Levant (ISIL, also known as ISIS) as they try to get the upper hand in the 16-year war.

The latest attack comes weeks before the Taliban usually launches its spring offensive.

The group is under growing pressure to take up President Ashraf Ghani's offer of peace talks but so far it has not responded.