About 60 rail passengers had to be led to safety after their train crashed into a large metal object left on tracks near Caerphilly, south Wales.
Police say the incident was "extremely serious"
Detectives are describing the incident close to Llanbradach station on Friday night as a "significant attempt" to derail a train.
Arriva Train Wales described those responsible as "mindless idiots" who had put lives at risk.
None of the passengers was injured and an investigation is continuing.
The train operator said services in the area are running properly again after the track was inspected by engineers.
But a spokesman for Arriva Trains Wales added: "Any attempt to derail a train is extremely serious and those responsible have disregard for property and life.
"They obviously didn't consider seriously the consequences of their actions.
"It's difficult to understand and comprehend the actions of these mindless idiots."
The incident happened at 2105 GMT when the Arriva train service from Penarth to Rhymney struck the grease pot close to Llanbradach station.
Passengers on the train were led to safety along tracks and then onto coaches.
Arriva Trains said the damaged train then "limped" into Cardiff for repairs.
British Transport Police, who are investigating, said they were treating the incident as "extremely serious".
A spokeswoman added: "This is considered a significant attempt to derail a train.
"The offence of endangering the safety of passengers is punishable with life imprisonment."
Anyone with any information relating to the incident is urged to call BTP on 0800 405040.