KABUL, Afghanistan — Taliban fighters unleashed a barrage of gunfire and rocket-propelled grenades at the headquarters of Afghanistan’s election commission on Saturday, a week before Afghans are to vote for a new president in an election that the Taliban has vowed to disrupt. There were no immediate reports of casualties.

Afghan officials and witnesses said the attack began shortly before 1 p.m. when at least three militants entered a building overlooking the headquarters of the Independent Election Commission, a grassy compound of low-slung buildings on the eastern edge of Kabul.

Sediq Sediqqi, the spokesman for the Interior Ministry, said the militants had not managed to get beyond the building from where they launched the attack. They were quickly holed up inside, surrounded by regular police officers and elite paramilitary commandos. The building was some distance from the election commission’s compound, he said.

“The attackers have started engaging with our police units and soon they will be flushed out of the building,” Mr. Sediqqi said in a brief telephone interview.