Thousands of Kenyans gathered on Tuesday to mourn the country's longest-serving leader, the hardline Daniel arap Moi, as a week of homage climaxed with a state funeral.

Moi, whose 24-year rule saw Kenya become a one-party state where critical voices were ruthlessly crushed, died on February 4 aged 95.

Military officers carried the coffin, which was draped with the national flag
Military officers carried the coffin, which was draped with the national flag AFP / SIMON MAINA

Mourners began gathering at a national athletics stadium before dawn to pay their respects.

Moi, who towered over Kenya between 1978 and 2002, lay in state for three days in parliament, with tens of thousands of people filing past.

On Tuesday morning, he was taken on a gun carriage draped in Kenya's flag through the streets of Nairobi to the crowded Nyayo national stadium flanked by soldiers.

Women from Maralal in northern Kenya attended the funeral
Women from Maralal in northern Kenya attended the funeral AFP / SIMON MAINA

President Uhuru Kenyatta, who opened the memorial with the national anthem, called Moi "a champion of Pan-Africanism."

The cortege entered the stadium flanked by long lines of red-coated soldiers and a brass band playing marching tunes and Christian hymns, their boots glinting in the bright sun.

President Uhuru Kenyatta praised Moi as a 'champion of pan-Africanism'
President Uhuru Kenyatta praised Moi as a 'champion of pan-Africanism' AFP / SIMON MAINA

"The Last Salute", Citizen TV wrote. "Fare thee well, 1924-2020" national broadcaster KBC headlined.

Former opponent Raila Odinga, who was jailed for several years under Moi, called the late leader a "greater fighter" who eventually accepted multiparty politics.

Several East African leaders, including Ethiopian President Sahle-Work Zewde, attended the funeral
Several East African leaders, including Ethiopian President Sahle-Work Zewde, attended the funeral AFP / SIMON MAINA

"I was one of the victims... but he was also forgiving, like I am also forgiving, and we made our peace, and we shook hands, and then worked together," Odinga said.

"We remember the good things that he did," he added.

Those targeted by his regime included human rights and environmental activists, including the writer Ngugi wa Thiong'o and the future Nobel Peace Prize winner Wangari Maathai.

Thousands of Kenyans gathered for Moi's funeral
Thousands of Kenyans gathered for Moi's funeral KTV /

Moi was however praised for keeping Kenya a relative haven of peace during a chaotic period in East Africa which saw the genocide in Rwanda and civil wars in Burundi and Somalia.

His later return -- under significant pressure -- to multiparty elections in 1992, and peaceful handover of power to opposition leader Mwai Kibaki in 2002 also won him some praise.

Several foreign leaders from regional nations attended the ceremony, including Djibouti's Ismail Omar Guelleh, South Sudan's Salva Kiir and Uganda's Yoweri Museveni.

Ethiopian President Sahle-Work Zewde and former Tanzanian presidents, Jakaya Kikwete and Benjamin Mkapa, spoke at the ceremony to offer their condolences to Kenya.

"One of the gallant leaders of this great country," Rwandan President Paul Kagame said.

The body of the late president will be buried on Wednesday in his home area of Kabarak, 220 kilometres (135 miles) northwest of Nairobi.

While those at the stadium had come to pay their respects to a ruler they revered, others in Kenya remembered a man they had long feared.

Moi's rule saw critical voices crushed, corruption become endemic and tribal divisions stoked and turn bloody.

"Even as we mourn Moi's death, let us not forget how he messed up this country," said Jared Opiyo, from Nairobi's poor and crowded Kibera district.

"Kenya could have been very far (ahead) if he took his job seriously. Instead he plundered the economy and encouraged tribalism."

However, Moi was praised for keeping Kenya a relative haven of peace during a chaotic period in east Africa.

"Every other leader after him has been advancing from where he left," Njeri added. "May he rest in peace."