The Russian president described the violent shooting as “a bloody, barbaric terrorist act” after a group linked to the Islamic State claimed responsibility for the event.