An Afghan army helicopter crashed in northern Afghanistan on Sunday, killing all seven people on board, the defence ministry said, citing technical failure.

But the Taliban claimed they shot down the M-17 helicopter in Baghlan province, as the insurgents step up attacks on government forces.

"Around 4am, two M-17 helicopters were supplying a base in Qorghan Tepa of Baghlan, and one of them caught fire due to technical failure and crashed," the defence ministry said in a statement.

"Four crew members and three army soldiers were martyred in the incident," it added.

The crash comes as Afghan forces are battling to flush out Taliban insurgents from neighbouring Kunduz after they stormed into the city on Monday.

The militants subsequently attempted to overrun Pul-e Khumri, the capital of Baghlan, but Afghan forces managed to repel the attack.

Taliban spokesman Zabihullah Mujahid claimed responsibility for the helicopter crash, saying RPG-armed fighters shot it down. The insurgents are routinely known to exaggerate battlefield claims.