Under the deal , Pakistan 's military will stop its crackdown in the border region if the militants disarm or expel foreign al-Qaida-linked fighters and stop attacks within Pakistan and in Afghanistan .