Afghan President Hamid Karzai has escaped unhurt after the Taleban fired rockets at a meeting he was addressing at a school in the province of Ghazni.
Several rockets were fired but missed their target and nobody was hurt, according to government officials. They said three people had been arrested.
Some of the audience panicked during the incident, but Mr Karzai urged calm and was able to finish his speech.
Earlier, officials said 30 Taleban and two police were killed in fighting.
Militants attacked police in Badghis province, in north-west Afghanistan, near the Turkmenistan border, officials said.
Mr Karzai was speaking at this school in Andar district, pictured here a week ago
The Taleban have disputed the government's account.
The police chief of Badghis province told the BBC that a large number of Taleban insurgents had launched an attack in a remote district on Saturday afternoon.
He said that in six hours of fighting, 30 of the Taleban and two policemen were killed, adding that the district was back in government control.
A Taleban spokesman, also talking to the BBC, contradicted this account, saying the rebels were in control of the district and had inflicted heavier casualties on the government side.
In other developments:
- Twenty-seven insurgents have been killed in Nato air strikes in the district of Shinkay in the southern Zabul province, the defence ministry says
- A general has been shot dead in central Kandahar while having his hair cut
- A British soldier has been killed in the southern province of Helmand
'Concerned and worried'
Officials said Mr Karzai's visit to Ghazni was routine.
He was giving a speech to elders and residents of Andar district about the building of roads and hospitals in the area when the attack occurred.
Rockets fell a few hundred metres from where Mr Karzai was speaking.
He was interrupted by the sound of rocket fire, but tried to continue his speech.
As some of the audience started to shift nervously, local journalists said, he urged them: "Sit down, sit down, do not be scared, nothing is happening, we are still talking."
The Afghan president, who has survived two assassination attempts in recent years, was taken away under heavy security.
Officials said three people had been arrested, but gave no further details.