Militants launch attack on city north of Baghdad