The bomb went off in the city of Dera Ismail Khan Monday as worshipers were leaving the mosque after evening prayers .