A Spanish policeman and a sniffer dog were killed, while another officer lost his leg on Tuesday after a backpack bomb exploded following a shooting.