Three suicide bombers wearing police uniforms and burqas on Saturday attacked the United Nations office in the western Afghan city of Herat, senior police and UN officials said.
There were no casualties among UN workers, Delawar Shah Delawar, deputy police chief of Herat province, told AFP after the raid, which was claimed by the Taliban.
"One of the suicide attackers drove his explosives-packed vehicle into the rear gate of the compound. The two other attackers tried to enter the building after the blast but they were killed by guards and policemen," he said.
"At this stage we are searching the compound to make sure there are no attackers hiding inside the building," he said, adding: "The attack did not cause any casualties to security forces or UN workers."
UN officials in Kabul and Herat confirmed the attack and that there were no deaths or injuries among UN staff, who had taken refuge in a safe bunker.
The United Nations has been seen as a specific target of the Taliban since last October, when a Kabul guesthouse was attacked and 12 people, including six UN employees, were killed.
The latest attack began at 12.30pm (0800 GMT), an AFP reporter on the scene said, adding that explosions and small arms fire was heard from inside the compound, which is about eight kilometres (five miles) from Herat city centre.
The remains of the vehicle lay by the destroyed gate, with body parts - possibly those of the attackers - strewn around it, the reporter said.
Henri Burgard, public information officer with the UN Assistance Mission in Afghanistan (UNAMA) in Herat, said the attackers were on foot.
"There have been either rockets or mortars fired at us and then some small arms fire," he said, speaking from a nearby guesthouse.
Interior ministry spokesman Zemarai Bashary confirmed an attack and said the area had been cordoned off by police.
Taliban spokesman Yousuf Ahmadi, speaking by telephone from an undisclosed location, said the militant Islamist group was behind the raid.
"We carried out the attack on the UNAMA office in Herat. The attack is still ongoing and so far 12 UNAMA guards and workers have been killed," he said.
The Taliban routinely exaggerate the scale and impact of their operations.
Herat, Afghanistan's second biggest city, is near the border with Iran. It has until recently been relatively peaceful though the security situation has been deteriorating.
Residents say that the road to the airport is controlled after dark by criminal gangs who kidnap for ransom. Some districts of the city, notably those dominated by ethnic Pashtuns, are controlled by Taliban insurgents, they say.
In January, the US consulate under construction in Herat came under rocket fire. There were no casualties.
The Taliban said earlier this year that all foreigners - including troops, diplomats and aid workers - and Afghans working for them were considered legitimate targets in their war against the Western-backed Kabul government.