Foreign hand behind terrorism in Pakistan and Iran: Envoy