At least 42 people were wounded.
The attack — which came on the heels of a major upsurge in rebel violence in recent months including assassinations, almost daily clashes with rebels and the kidnapping of an Italian aid worker — further raised fears that militants here are copying the tactics of insurgents in Iraq.
The rebels themselves have suffered a heavy price — losing about 200 men according to American and Afghan officials — but the drumbeat of attacks has belied U.S. claims that it is stabilizing the country, nearly four years after driving the Taliban from power.
Kandahar Gov. Gul Agha Sherzai said the suicide bomber's body had been found, and that he was part of Osama bin Laden's terror network.
"The attacker was a member of al Qaeda. We have found documents on his body that show he was an Arab," Sherzai told reporters.
A purported Taliban spokesman, Mullah Latif Hakimi, said in a telephone call earlier to The Associated Press that the rebels were not responsible for the bombing. Hakimi often calls news organizations, usually to claim responsibility for attacks on behalf of the Taliban. His information has sometimes proven untrue or exaggerated, and his exact tie to the rebel leadership is not clear.
Hundreds of mourners were crowded inside the Mullah Abdul Fayaz Mosque in the center of the main southern city of Kandahar when the bomb went off around 9 a.m., leaving blood and body parts littered over a wide area.
Interior Ministry spokesman Latfullah Mashal said the capital's police commander, Gen. Akram Khakrezwal, was killed along with some other police officers attending the funeral. Mashal said it was a suicide bombing.
Witnesses described the carnage:
"I was knocked unconscious by the blast. When I woke up, so many people were killed or wounded. People were running around, some were lying on the ground crying. Dead bodies were everywhere," said Nanai Agha, a mourner who was inside the mosque but survived the blast because he was behind a wall when the bomb detonated.
Kandahar's deputy police chief, Gen. Salim Khan, said the explosion occurred near where people remove their shoes before praying.
Nazir Ahmadzai, a doctor at Kandahar Hospital, said 20 people had been killed and 45 wounded — many of them Khakrezwal's bodyguards. The hospital's director, however, said 72 were wounded, four gravely.
"The wounded are telling me that a suicide attacker entered the mosque and then blew himself up," said hospital chief Mohammed Hashim Alokozai.
Mashal, the Interior Ministry spokesman, denounced the attack as an atrocity against both the nation and Islam.
"They are the enemies of peace and the enemies of Islam," he said. "Attacking Muslims while they are offering prayers and performing religious ceremonies is completely against Islam, against our country."
Col. James Yonts, the U.S. military spokesman in Afghanistan, also condemned the blast, saying in a statement that it was an "atrocious act of violence upon innocent civilians and a mosque."
Many local leaders had been expected to attend the funeral of Mullah Abdul Fayaz, the top Muslim leader in the province, whom the mosque is named after.
Fayaz, a supporter of President Hamid Karzai, was shot dead in Kandahar on Sunday by suspected Taliban gunmen — a week after he led a call for people not to support the rebels.
Even before the blast, security was tight. Afterward, more police were deployed around the mosque, the main city hospital and other sites around the city.
Kandahar was a stronghold of the Taliban regime that was ousted from power in late 2001 by U.S.-led forces for harboring bin Laden.
In a second attack Wednesday west of Kandahar, a bomb exploded on a bridge as a group of Afghan deminers were driving over it, killing two of them and wounding five others, said Patrick Fruchet, spokesman for the U.N. Mine Action Center for Afghanistan.
The seven were working on a project funded by the Japanese government, he said.
Kandahar has been hit by big bombings before.
On March 17, a roadside blast killed five people and injured more than 30. Authorities blamed anti-government rebels for the attack, which took place as U.S. Secretary of State Condoleezza Rice was in the capital Kabul, 280 miles to the north.
In January 2004, a bomb attached to a bicycle killed at least 15 people, most of them children, and injured dozens more in the city. Authorities blamed Taliban militants.