Russia's Federal Security Service (FSB) says it has prevented an alleged terrorist attack targeting railway infrastructure in Pyatigorsk, releasing dramatic footage of officers detaining the suspect.