More than 40 people were wounded in the attack at the front of the mosque in Maymana, capital of Faryab province.
The provincial governor and police chief were said to be among those attending the prayers to mark the Eid al-Adha holidays, but they reportedly escaped without serious injury.
Civilians and police officers were among the dead, officials said.
Eye witnesses and officials said the suicide attacker approached the mosque and detonated his suicide vest after the Eid prayers had finished.
It is not clear now the attacker managed to get past at least four security checkpoints to target the mosque.
Deputy provincial governor Abdul Satar Barez told the AFP news agency that the attacker himself was 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 at least 10 people were killed in an incident in April 2012 when a suicide bomber on a motorbike targeted a meeting of officials near the main vegetable market in Maymana.
The US House Ethics Committee has voted to release its report on former Republican Representative…
ABC News has agreed to pay $15 million to President-elect Donald Trump to settle a…
South Korea’s parliament has voted to impeach President Yoon Suk Yeol over his failed attempt…
Israeli war planes have carried out more than 100 air strikes in Syria on December…
President-elect Donald Trump has threatened to impose 100% tariffs on the BRICS countries if they…
Syrian troops have withdrawn from the city of Aleppo following an offensive by rebels opposed…