Anti-terror pact reached with NW tribesmen