Afghanistan has begun three days of mourning, a day after dozens of people were killed in what is being called the country's worst suicide bombing.
Politicians, children and teachers were among those killed in the devastating attack in northern Baghlan province.
The bodies of six MPs have been flown back to Kabul for a funeral ceremony.
President Karzai said the attack showed the need to fight extremism. It is not clear who carried out the bombing - the Taleban have denied responsibility.
At a news conference, President Karzai called the attack "miserable and sad".
Expressing his condolences to those who had perished or lost loved ones, he said extremists had to be fought "with dedication and seriousness".
"Our teams have gone to Baghlan for preliminary tasks to thoroughly investigate the issue," he said.
The exact number of casualties has not yet been established.
President Karzai said about 35 people had been killed - most of them children, teachers and MPs - while the provincial governor told the BBC there had been 41 deaths.
The BBC's Alix Kroeger in Kabul says it is still not entirely clear whether this was a suicide bomb, although President Karzai said that was the most likely explanation.
But our correspondent says many questions remain, including that of responsibility.
The Taleban have denied that they carried out the attack, but they and al-Qaeda are the only ones known to use suicide bombs in Afghanistan so far.
If it was not a suicide bomb, then that widens the field considerably to take in other political or armed factions, our correspondent says.
Fighters loyal to Gulbuddin Hekmatyar - a former mujahideen leader who is battling the Kabul government independently from the Taleban - are known to be active in Baghlan.
Scene of carnage
The bomb exploded at a sugar factory in a town in Baghlan province while a delegation of parliamentarians was visiting.
KEY BOMB ATTACKS SINCE 2001
29 Sept 2007
Suicide attack on Kabul bus kills 30
10 Sept 2007
At least 20 dead in two suicide bombs in Gereshk, Helmand province
17 June 2007
At least 35 dead in bomb attack on Afghan police bus in Kabul
3 Aug 2006
Car bomb kills at least 21 in Kandahar province
16 Jan 2006
Suicide bomb kills at least 20 people in Spin Boldak, Kandahar province
1 June 2005
At least 20 people killed in bomb attack on mosque in Kandahar city
"The children were standing on both sides of the street, and were shaking the hands of the officials, then suddenly the explosion happened," said Mohammad Yousuf Fayez, a doctor at Baghlan's main hospital, the Associated Press reports.
The scene of the attack was left littered with bodies and splattered with blood. Shoes, sandals, hats and notebooks were scattered about.
Among the MPs killed was Mustafa Kazimi, a former mujahideen fighter and prominent opposition figure.
Tuesday's bombing shows the reach of the insurgency is growing, analysts say.
Until now, most suicide attacks have taken place in Afghanistan's south and east, or in Kabul. Such bombings in the north are rare.
Germany, which has troops stationed in the north, said the attack was aimed at scaring off international help to rebuild Afghanistan.
The Taleban, al-Qaeda and other militant groups are fighting thousands of Afghan and foreign soldiers in Afghanistan.
Civilians have often been the victims of the violence in Afghanistan - not only in attacks by insurgents, but also in bombing by Nato and US forces in the country.