Nairobi, Kenya Former Kenyan President Daniel Arap Moi, who ruled the country for 24 years, has died, President Uhuru Kenyatta announced Tuesday. Moi was 95.

"It is with profound sadness that I announce the death of a great man of an African state," Kenyatta said in a statement.

He ordered a period of national mourning and all flags to fly at half-staff until a state funeral is held at a later date.

Moi died at a hospital in the early hours of Tuesday morning surrounded by his family, Kenyatta said.

He had been hospitalized in October for breathing problems but was discharged after a few weeks.

An autocratic rule

Moi was born September 2, 1924, in Baringo County. He became Kenya's second president after independence and went on to rule from 1978 to 2002.

His wily grasp of power earned him the nickname "Professor of Politics" amongst Kenyans.

His 24 years in power encompassed one-party rule through the Kenyan African National Union, the party he controlled, and also the reintroduction of democracy and multiparty politics, which culminated in his victory in the 1992 Presidential elections.

He became the Minister of Home Affairs and President Jomo Kenyatta later named him Vice President in 1967.

Moi became Kenya's leader after Jomo Kenyatta's death in 1978 , bringing in an era of autocratic and at times dictatorial rule that made Moi and his family extremely wealthy.

After he stepped down, Kenya located more than $1 billion of public money stashed in overseas offshore accounts, which it sought to recover, the New York Times reported.

Quashing rebellion

Four years after Moi came to power, some members of the Air Force attempted a coup, which Moi successfully and ruthlessly crushed.

After the attempt, Moi's rule became more hard-nosed -- he dismissed political opponents and reduced the influence of his predecessor's allies in his cabinet.

He went on to change the constitution, making his KANU party the only legally permitted political entity and triggering the wrath of many Kenyans who sought democracy.

Pressure from Western backers forced Moi back onto the democratic path in 1990 and he was compelled to allow opposition parties onto the ballot before the 1992 general elections -- Kenya's first multi-party elections -- which Moi won, despite allegations of electoral fraud by his party.

Widespread influence

As a statesman Moi had widespread influence in cementing East African countries like Uganda and Tanzania into a coherent trading block. On March 14, 1996, full East African Cooperation efforts began and in July 1999 the new East African Community was born.

He also rallied to the cause of anti-apartheid in southern Africa, sending Kenyan soldiers into pre-independence Zimbabwe as peacekeepers during the ceasefire there in 1979.

While he was the Chairman of the Organization of African Unity, Moi was involved in securing peace in Chad. In Sudan, Moi chaired the talks that led to a referendum that ended a three-decade war in South Sudan and the creation of a new nation in July 2011.

With 24 years at the helm of Kenya's government, Moi had a massive impact in shaping Kenya's politics and governmental structures. Subsequent presidents, Mwai Kibaki and Uhuru Kenyatta, can be said to have been appointed by the elder statesman.

He appointed Kibaki as his Vice President and paved the way for him to later lead Kenya. He then plucked a largely unknown and untested Kenyatta from relative obscurity and pushed him to the forefront of Kenyan politics.

As a former teacher, Moi's legacy also included a wide expansion of higher education. It was during the Moi era that the university sector grew starting with the opening of Kenya's second university in Eldoret, a town in the north.

Other universities followed, including private educational institutions run by Methodists. Today Kenya has more than 60 universities and public university colleges.