Kenya's longest-serving president Daniel Arap Moi, whose rule was marred by corruption and torture of opponents, has died, the office of the president said.

He was 95.

There was no immediate explanation for Mr Moi's death, but he had been in and out of hospital with breathing problems in recent months.

Plaudits poured in from Kenyan politicians, but some of his victims were less forgiving.

"Our nation and our continent were immensely blessed by the dedication and service of the late ... Moi, who spent almost his entire adult life serving Kenya and Africa," President Uhuru Kenyatta said in a statement.

Mr Moi died peacefully in hospital at 5.20am (2.20am Irish time), surrounded by his family, said his son Gideon Moi, a senator.

Mr Moi came to power in 1978, when he was serving as vice-president and the nation's first leader President Jomo Kenyatta died.

He remained in power until the end of 2002 when his constitutional term ran out.

Uhuru Kenyatta, the son of Jomo Kenyatta, was Mr Moi's preferred successor but lost the election to the opposition.

Uhuru Kenyatta became president in 2013.

Mr Moi is credited for keeping Kenya relatively stable compared with its troubled neighbours, and he worked for peace in the region.

However he oversaw massive corruption scandals that are still costing Kenyan taxpayers.

One scandal, Goldenberg, led to the loss of at least  $1 billion in central bank money via compensation payments for bogus gold and diamond exports.

The economy stagnated under Mr Moi, leaving millions mired in poverty.

Diplomats said an attempted coup in 1982 transformed Mr Moi from a cautious, insecure leader into a tough autocrat.

Mr Moi rewrote the constitution to legalise de facto one-party rule, which secured power for his Kenya African National Union until 1991, when Mr Moi caved in to international pressure to reintroduce multi-party politics.

His government set up interrogation chambers in the basement of Nyayo House, a government building in central Nairobi that now houses the immigration department.

Thousands of activists, students and academics were held without charge in the underground cells, some of them partly filled with water.

Prisoners say they were sometimes denied food and water and beaten to confess to fictitious crimes or just for revenge.

"There remains the legacy of disappearances and unexplained deaths, detention without trial, repression of freedom of expression and the media," said human rights lawyer Gitobu Imanyara, who was held in solitary confinement for two years.

"I never knew if I was going to make it out alive - I still carry scars. Some people were not as lucky as I am. They died. These are the people we need to remember."

Mr Moi barely survived demands for his resignation over the 1990 murder of Foreign Minister Robert Ouko, an important Luo leader.

In 2010, a government inquiry into the death, presented to parliament five years after it was written, said the murder was carried out in one of Mr Moi's official residences.