You are always entitled to a mental health lawyer (if one agrees to see you) but there are limits to when the state will pay the fees for you. Legal Aid covers “services provided in relation to matters arising under … the Mental Health Act 1983” (LASPO 2012, sch 1, part 1, para 5) so there could be pre-detention circumstances in which you would be entitled to Legal Aid. In the mental health context, except for tribunal proceedings, Legal Aid is generally means-tested.