Pakistani security forces have killed at least 12 militants and thwarted an attempted hostage-taking in southwestern Pakistan.