A major incident was declared and homes were evacuated after a freight train carrying a large quantity of diesel caught fire near Llanelli.
Police said a number of cars had derailed and caught fire, after receiving reports of the fire in Llangennech around 11:20 a.m. Wednesday evening.
UK Transport Police said two workers were on board the freight service but were not injured.
Residents living within half a mile of the blaze have been told to evacuate and meet at Bryn School and Llangennech Community Center, but have since been allowed to return home.
Dyfed-Powys Police, UK Transport Police, Central and West Wales Fire and Rescue Service are on scene, with support from Carmarthenshire Council and Natural Resources Wales.
Dyfed-Powys Police Commissioner Ross Evans said: “This was a rapidly evolving situation, which was declared a major incident due to the initial risk of harm to people living in the area.
“The police response was large-scale, with officers from across the force kept on duty to ensure we had sufficient resources to carry out the evacuation quickly, as well as the deployment of a logistics specialist. to assist and advise our officers on the safe movement of people from their homes to reception points.
“The evacuation undoubtedly caused significant disruption for those evacuated in the middle of the night, and I would like to personally thank the residents for their response, as well as our frontline officers who quickly moved hundreds of residents from Their houses. ”
People are advised to avoid the area while emergency services continue to fight the fire.
The A4138 Pontardulais road was closed from the Troserch road to the M4 J48 due to the fire.
An investigation into the cause of the fire has been opened by the British transport police.
British Transport Police Deputy Chief Sean O’Callaghan said: “The fire continues and there is still a substantial risk in its immediate vicinity, so we continue to advise people to avoid the area.“Our officers will conduct initial investigations into the incident and are in the process of securing key witness statements and CCTV. “Once the fire has been extinguished and the scene can be safely assessed and investigated, we will work with the Office of Railways and Roads and the Railway Accident Investigation Branch to establish the exact circumstances. of the incident. “
Natural Resources Wales said officers were providing advice to help manage the environmental impact of the diesel spill.
A spokesperson said: “We will fully assess the impact once the fire is contained and it is safe to do so. “