The Pakistani military has twice declared victory there following offensives aimed at clearing the area of insurgents linked to the Taliban and al-Qaida .