South Waziristan lies at the southern end of Pakistan 's tribal belt , a largely ungoverned swath of mountains along the Afghan border from where militants mount attacks on security forces on both sides of the border .