Legal status of hundreds of thousands of immigrants at risk after talks collapse