A suicide attacker has killed at least 41 people and injured 51 in northern Afghanistan, local officials have said.
The attack on Friday occurred when a man detonated explosives that he was carrying outside a mosque in Maymana, the capital of Faryab province.
Witnesses say the attacker was wearing a police uniform as he passed through four security checkpoints.
He blew himself up at the entrance to the city's packed Eid Gah mosque, deputy provincial governor Abdul Satar Barez told the AFP news agency.
"Our latest death toll shows 41 deaths, and that might rise," he said.
"Nineteen were members of the security forces, including police, army and intelligence agents. Seventeen were civilians and five children are also among the dead."
Faryab, in Afghanistan's northwest, had been mostly peaceful until last week, whenan Afghan special forces operation killed the Taliban’s shadow provincial governor. Over 20 fighters were also killed in the attack.
Sediq Sediqqi, Afghan ministry of interior spokesman, called that operation "very successful" and cited it as a possible basis for Friday's attack.
Al Jazeera's Bernard Smith, reporting from Kabul, said the 41 victims were a mixture of civilians and members of the Afghan National Security Forces.
The bulk of those killed were outside the mosque at the time of the attack.
"It appears the target was military and security force members", he said.
The provincial police chief sustained some injury.
Barez, like many other provincial officials, was at the scene at the time of the bombing and described the horror of the blast in the midst of a religious celebration.
"We had just finished Eid al-Adha prayers and we were congratulating and hugging each other," he said.
"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."
No group has claimed responsibility for the attack.
One witness, Sayed Moqeed, described the bomber as appearing to be in his early teens.
"Suddenly I heard a very big explosion," he said. "Everywhere were pieces of bodies, hands and limbs. The suicide attacker was in police uniform, he looked to be around 14 or 15 years old."
Candace Rondeaux, a senior Afghanistan analyst with the International Crisis Group, a think-tank, said there were other actors participating in the conflict apart from the Taliban.
"There's so much focus on the Taliban and, of course, the pro-Islamist insurgency. What has to be remembered is that it is a deeply fragmented security environment where you have rival factions operating on a district-by-district [and] province-by-province basis," she told Al Jazeera.
Surge in violence
Recently tribal elders seen as supporting the government have been killed by the Taliban in Faryab.
Rondeaux said in the north there had been an increase in violence in the past six months and targeted assassinations, particularly in the neighbourhood of Faryab, citing the killing three months ago of a member of parliament.
"We are likely to see a lot more skirmishes as the transition [that will follow the withdrawal of foreign troops] continues," she said.
The attack comes on the first of the three-day Eid holiday in Afghanistan.
| Our complete Afghanistan coverage
Hamid Karzai, the Afghan president, strongly condemned the attack, calling the perpetrators "the enemies of Islam and humanity".
"Those who take the happiness of Muslims during Eid days cannot be called human and Muslim," he said.
The US embassy in Kabul also "strongly" condemned the attack saying: "This attack against innocent worshippers further demonstrates the insurgency’s lack of respect for religion, faith and its disregard for the safety and security of the Afghan people ... Our sympathies go out to those affected by today’s bombing, and we wish a speedy recovery to the wounded".
Northern Afghanistan is relatively peaceful, with the Taliban, toppled from power in a US-led invasion in 2001, concentrating their operations in the south and east of the country.
The UN says 1,145 civilians were killed in the war in the first six months of this year, blaming 80 per cent of the deaths on anti-government fighters. Last year as a whole, a record 3,021 civilians died in the war, according to UN figures.