A group of Taliban fighters have attacked a court in the northern city of Kunduz in Afghanistan, killing at least seven people including prosecutors.

The prosecutors were shot in their offices at close range, officials said on Monday.

Four attackers wearing army uniforms attacked the provincial appeals court, setting off a four-hour gun battle with Afghan security forces, Sayed Sarwar Hussaini, provincial police spokesman, told AFP news agency.

"They first blew up an explosives-laden car at the gate of the court and then entered the building."

The attackers "killed six court officials and one police. Eight people were wounded", Hussaini said, adding that the fighters were also killed.

Live Box 201491152731407786

Amruddin Amin, chief prosecutor, said the attackers went door-to-door in the court compound, shooting their victims at close quarters.

The Taliban claimed responsibility for the attack on their website and said several court officials and prosecutors were killed.

Kunduz has been a peaceful city compared to other Afghan towns but recently the Taliban has been gaining ground across the province.

Fighting also took place in the northern province of Faryab and in Logar province, close to the capital Kabul.

This is not the first time such an attack has taken place. In April 2013 armed groups stormed a provincial court in the western town of Farah, killing 44 people in a bid to free fighters standing trial.

The dead included 34 civilians, while all nine attackers were also killed. The group claimed that 13 of their prisoners used the opportunity to escape.

A suicide car bomber also drove into the Supreme Court building in Kabul in June last year, killing 15 civilians and wounding 40 others including women and children.

Source: Agencies