Militants set off a bomb and opened fire on people attending prayers at a mosque in Egypt’s northern Sinai.