Families that are living on railway reserves have been ordered to leave to allow for rehabilitation of the rail line.
The warning comes following a fire in Naivasha on Monday that left more than 3,000 families in KCC village, which is located on Kenya Railways Corporation (KRC) land, homeless.
The residents lost property whose value is yet to be known after a fire gutted their houses.
KRC said it had issued many public notices last year to encroachers asking them to voluntarily vacate railway reserves to pave way for safe railway operations and expansion.
According to KRC, the encroachment of its land has continued to impede efforts by the company to provide improved services to industrial clients and other organisations that use the railway as a mode of transport.
“It is important to note that the safety of illegal occupants of railway reserves is compromised because trains can either run over persons or cause damage to property,” said KRC managing director Nduva Muli.
Mr Muli said that in many instances, trains are loaded with flammable and toxic materials and that if an accident occurred those living in the reserves could be injured or killed.
The company is also exposed to unwarranted claims for compensation from the victims.
KRC is expanding and modernising its rail network in Nairobi in a bid to decongest roads in the capital.
In addition, the new modernised and expanded commuter rail system will involve the operation of more trains at higher speeds.
The corporation said it sympathised with those who lost their property.