A suicide bomber targeted worshippers who had gathered at a mosque in north Afghanistan for prayers to mark Eid al-Adha, killing at least 37 people.
More than 30 people were wounded in the attack, which happened as people were leaving the mosque in Maymana, capital of Faryab province.
Senior provincial government officials were also attending the prayers.
The victims were mainly civilians and police officers. Senior officials appeared to escape serious injury.
"We had just finished Eid al-Adha prayers and we were congratulating and hugging each other," deputy provincial governor Abdul Satar Barez told the AFP news agency.
"Suddenly a big explosion took place and the area was full of dust and smoke and body parts of police and civilians were all over the place. It was a very powerful explosion."
He said the provincial police chief, Abdul Khaliq Aqsai was wounded, but it was not clear if he had been the target.
The BBC's Bilal Sarwary in Kabul says that security had been very tight around the mosque, and questions will now be asked as to how the attacker managed to get past at least four security checkpoints.
Mr Barez said the attacker had been wearing a police uniform.
Attacks in northern Afghanistan are far less common than in the south and east, and Faryab province has been considered to be relatively peaceful.
However, there have been a spate of assassinations in Maymana in recent days, our correspondent says.
A senior former Taliban commander, who had defected to the government side, was killed along with son, as well as a number of very prominent tribal elders seen to be giving crucial support to the government.