The men accused of carrying out the mass shooting had spent time in the Philippines, where Islamic State-linked networks are known to operate.