Afghan President Hamid Karzai wept and wailed Wednesday as he attended the funeral for his slain half-brother, the man known unofficially as the "king of Kandahar."

Karzai and thousands of others joined the funeral for the powerful Ahmed Wali Karzai, who was assassinated Tuesday by one of his bodyguards, a trusted associate from his tribe and hometown.

Karzai, 50, was shot in the head and chest by his attacker, whom the Taliban claimed had been recruited to the insurgency to carry out the assassination.

The shooter, identified as Sadar Mohammed, was reportedly shot and killed by Karzai's security team after his attack on Karzai. He had worked with Karzai for seven years.

On Wednesday Karzai's memorial began with a morning prayer service in Kandahar. Then attendees travelled to Karz, the ancestral hometown for the Karzai family, for the funeral.

Karzai's large, wooden casket was adorned with red flowers as it was brought forward and lowered into the ground, under the watchful eye of security helicopters flying overhead.

The president himself was surrounded by a ring of security guards as he made his way through the crowd to the open grave, weeping and visible upset, according to reports.

Upon reaching the graveside, Karzai then climbed down into it and disappeared from view, his wails of mourning audible to the crowd of thousands.

The distraught Karzai was eventually physically pulled out of the grave by two men after he ignored requests to emerge.

Karzai later called on the insurgents to stop their violent tactics.

"My message for them (the Taliban) is that my countrymen, my brothers, should stop killing their own people," said Karzai. "It is easy to kill and everyone can do it, but the real man is the one who can save people's lives."

Wali Karzai had survived nine previous attempts on his life, and once called himself "the most wanted" man in Afghanistan.

With his death, Hamid Karzai and NATO have lost a valuable ally in Afghanistan's volatile south, where he was a master operator who could balance resourcefulness and ruthlessness with groups ranging from tribal and political leaders, to drug runners and militias.

The Afghan government is in the midst of peace talks with insurgents in the south ahead of the withdrawal of U.S. troops.

CTV's Mercedes Stephenson said Karzai was an important figure in Kandahar whose death will result in a power vacuum.

"He was the most powerful broker there was in Kandahar. His nickname was the King of Kandahar and in the short term there is no one there who had his position," she told CTV News Channel. "He was involved with the CIA, he was involved sometimes with the Taliban, he was involved with Western forces, he had a position on the legislative council there. So really this is someone who had a finger in every pot."

In a statement claiming responsibility for the murder, Taliban spokesperson Zabiullah Mujahid, said Karzai was assassinated because he allied himself with the U.S. British and Canadian forces in the region.

He also accused him of being a "puppet" for the foreign powers and said he was on the U.S. payroll.

Karzai had led the provincial council in Kandahar for years, landing the position a few years after his brother took over as Afghan president following the 2001 U.S. invasion.

He denied being on the CIA payroll, or being involved with shady business dealings, the drug trade or gun running, of which he was often accused.

Karzai is believed to be survived by three daughters and two sons, including one who is just a month old.

With files from The Associated Press