UN warns of 'tragedy' as militants take over Iraq towns