A period of residence which is legal solely on the basis that a Residence Permit has been issued cannot count towards the 5 years of continuous residence needed to meet the so-called "right to reside" test (under EU Directive 2004/38) if it does not meet the conditions specified for that test (because, for example, the person concerned was voluntarily unemployed).