What challenges do security agencies face in identifying and preventing homegrown terror modules with foreign links?

The U.P. ATS arrested four people linked to a Pakistan-based terror module. I want to explore the difficulties in detecting such groups, especially when they have international connections but operate locally.