Militants seized three villages in northern Iraq on Wednesday during clashes with security forces and residents that left 20 civilians dead, a local official said.