Mastermind of Prayagraj violence detained, AIMIM link found: Police