Al Jazeera's Qais Azimy, reporting from the Afghan capital of Kabul, said gunmen equipped with a suicide vest tried to enter the headquarters of the intelligence office.
"Police said one of the gunmen detonated himself," Azimy said.
He said the clashes were now over and that the three attackers had been killed.
He said the Taliban claimed responsibility for the attack, saying it was targeting specific officials at the intelligence office.
Earlier in the day, international troops opened fire on a bus carrying Afghan civilians in the nearby Zhari district, killing four people and setting off anti-American protests in Kandahar city.
Another 18 people were wounded in the incident, Zelmai Ayubi, a provincial government spokesman.
He said international forces took 12 of the wounded to a military hospital.
Nato said it "deeply regrets" the deaths, and Hamid Karzai, the Afghan president, asked Nato forces to take "serious precautions" to avoid further civilian casualties, expressing "deep grief" over the incident.
The Taliban have carried out attacks in recent months in various parts of the country, including Kandahar, which is the target of a mass offensive planned by Nato-led forces in coming months.