At least 15 people have died and 42 others have been injured following a coordinated attack on a government building in the eastern Afghan city of Jalalabad.

Local officials have said Afghan security forces battled for hours against the group of attackers.

A car bomb was detonated at the entrance to the state accounts office before a group of about six attackers armed with machine guns and rocket-propelled grenades rushed the building, the officials said.

There were multiple blasts as they fought off security forces in a gun battle that lasted much of the day.

The attack took place in a busy area of the city with many other official buildings nearby, including a school in which about 1,000 girls were trapped as the fighting raged.

There has been no immediate claim of responsibility.

It was the latest in a series of high-profile attacks that have killed and wounded hundreds of civilians in Afghanistan this year and put heavy pressure on the Western-backed government of President Ashraf Ghani.

Most have been in capital city Kabul, but in January gunmen attacked an office of aid group Save the Children in Jalalabad, killing at least five people and wounding 25.

That attack, claimed by so-called Islamic State, followed much the same pattern as today’s incident.

After several hours of fighting that sent plumes of smoke rising into the sky above the accounts office, Attahullah Khogyani, a spokesman for the provincial governor, said that the attack had ended with all the gunmen killed.

Public health officials said that at least 15 people, including a child, had been killed and 42 were wounded.

Witnesses said the explosions had caused carnage among passers-by.

Violence has escalated across Afghanistan since the announcement of the Taliban's annual spring offensive last month and there have been heightened security fears around preparations for elections in October.

Dozens of people have been killed in voter registration centres in recent weeks, leading to fears that people could stay away from elections that are seen as a major test of the government's credibility.

At the same time, Taliban fighters have stepped up the pressure on government forces across the country, from Baghlan province in the north, where they seized a district centre last week, to Farah in the southwest or Ghazni, south of Kabul.

Last year the United States increased its support to struggling Afghan forces, announcing plans for thousands of additional advisers and more air strikes in an effort to force the Taliban to enter peace negotiations.