China has signed a deal to build the first stage of a line that will cross several African nations.

Exim Bank of China has agreed to build a $3.8 billion rail link between Kenya's Indian Ocean port of Mombasa and Nairobi, providing 90 per cent of the cost to replace the forlorn British colonial-era line with a new 609.3 kilometre (379 mile) standard-gauge link.

The Government of Kenya will pay for the remaining 10 per cent of the line which is planned to link Kenya, Uganda, Rwanda, and South Sudan.

China Communications Construction Co has been unveiled as the main contractor, with the three-and-a-half year first phase of construction due to start in October.

The deal was sealed by presidents Uhuru Kenyatta of Kenya, Yoweri Museveni of Uganda, Paul Kagame of Rwanda and Salva Kiir of South Sudan in a ceremony at State House in Nairobi and witnessed.

“This project demonstrates that there is equal cooperation and mutual benefit between China and the East African countries, and the railway is a very important part of transport infrastructure development,” Chinese Premier Li Keqiang said following the deal.

Premier Li has been touring parts of eastern Africa, as the world's second-biggest economy looks for new markets and opportunities on the continent.

President Kenyatta of Kenya told local reporters that the multi-billion deal was “based on mutual trust” and said Kenya “has found an honourable partner in China”.

“We are happy to see that China is concentrating on the real issues of development,” President Museveni of Uganda said.

“They don't give lectures on how to run local governments and other issues I don't want to mention,” he said.

Some of the issues Museveni did not want to mention may have included the recent criticism he has received over rampant government corruption and the recent signing of backward-thinking anti-gay legislation.