Mr. Basayev , nominally the movement 's second in command , has claimed responsibility for the worst terrorist attacks in Russia , including the hostage siege of a school in Beslan in 2004 that ended with the deaths of 331 people .