Police have shot dead a 16-year-old boy who stabbed a member of the public, saying the teenager was “radicalised” online.