At least 48 people, many of them civilians, were killed Wednesday in western Afghanistan when heavily armed Taliban insurgents, including suicide bombers, stormed government buildings and fought a seven-hour gun battle with security forces, police said.

More than 90 people were reported wounded in the assault on the city of Farah, capital of Farah province. Police said all nine of the attackers died in the fighting, either in exchanges of fire with security forces or by detonating suicide vests they were wearing.

The death toll was the heaviest in many months in Afghanistan, where the radical Islamist Taliban movement is fighting to drive out foreign troops and topple the government of President Hamid Karzai.

Several government buildings, including the provincial courthouse, were badly damaged in the clashes, officials said, adding that the Taliban fighters used explosives, assault rifles, hand grenades and rocket-propelled grenades.

“We had 48 people . . . killed and 91 people wounded,” provincial police chief Agha Noor Kemtoz said by telephone.

He said 34 of the dead were civilians and the rest security forces. Several court employees were also among the dead, but no high-ranking provincial officials were killed, he said.

The purpose of the attack was unclear, according to Kemtoz, another senior police officer and a spokesman for the governor. They expressed doubt about Taliban claims that it was aimed at freeing insurgent prisoners facing trial.

In the strike, one suicide bomber detonated an explosives-laden vehicle outside the courthouse,allowing several insurgents to enter the building, the officials said. Minutes later, two other attackers made their way into a private bank, they added.

The Taliban claimed responsibility for the attack in a text message to news media and asserted that insurgents standing trial were freed in the assault.

But Kemtoz denied that any Taliban members were freed. He said in a phone interview that 16 people were on trial, none of them Taliban militants. Instead, he said, two were accused of drug trafficking and the rest faced other criminal charges.

Kemtoz said no attackers were arrested who could specify the target of the raid, but he said he doubted it was linked to any trial.

Taliban insurgents have often stormed government and other buildings in various parts of the country, including Kabul. They have stepped up such tactics over the past couple of years, coinciding with the handover of security responsibility from foreign troops to Afghan forces.