Interior ministry spokesman Siddiq Siddiqi said 13 people were also wounded when the bomber blew himself up in the southern city of Kandahar, where cabinet ministers visiting from the capital Kabul had been in attendance.
The bombing again raises the prospect of renewed instability in Kandahar, one of Afghanistan's bloodiest battlegrounds and the birthplace of the Taliban, in the power vacuum created by the death of power-broker Ahmed Wali Karzai.
The head of the religious council for the southern province of Kandahar, Hikmatullah Hikmat, was among those killed Thursday, the government said.
An AFP reporter saw the government delegation rapidly evacuated after the attack in two Afghan army helicopters.
"It was a suicide attack. Four people have been martyred and 13 injured. The dead include Maulavi Hikmatullah, head of the Kandahar Ulema council," said Siddiqi, referring to the dead man by his religious title.
"The bombing was in a corner of the mosque. It's a big mosque," he said, adding that it was the venue for a service in memory of Wali Karzai, the younger half-brother of President Hamid Karzai shot dead at home on Tuesday.
A member of the Kandahar provincial council who attended the prayers confirmed it was a suicide bombing inside the mosque.